diff --git a/setup.py b/setup.py index 060a324c..e1de4165 100644 --- a/setup.py +++ b/setup.py @@ -64,8 +64,32 @@ ext_files = [ - ("flint._flint", ["src/flint/pyflint.pyx"]), # Main Module + # ("flint._flint", ["src/flint/_flint.pxd"]), # Main Module + ("flint.pyflint", ["src/flint/pyflint.pyx"]), # Main Module # Submodules + ("flint.types.fmpz", ["src/flint/types/fmpz.pyx"]), + ("flint.types.fmpz_poly", ["src/flint/types/fmpz_poly.pyx"]), + ("flint.types.fmpz_mat", ["src/flint/types/fmpz_mat.pyx"]), + ("flint.types.fmpz_series", ["src/flint/types/fmpz_series.pyx"]), + ("flint.types.fmpq", ["src/flint/types/fmpq.pyx"]), + ("flint.types.fmpq_poly", ["src/flint/types/fmpq_poly.pyx"]), + ("flint.types.fmpq_mat", ["src/flint/types/fmpq_mat.pyx"]), + ("flint.types.fmpq_series", ["src/flint/types/fmpq_series.pyx"]), + ("flint.types.nmod", ["src/flint/types/nmod.pyx"]), + ("flint.types.nmod_poly", ["src/flint/types/nmod_poly.pyx"]), + ("flint.types.nmod_mat", ["src/flint/types/nmod_mat.pyx"]), + ("flint.types.nmod_series", ["src/flint/types/nmod_series.pyx"]), + ("flint.types.arf", ["src/flint/types/arf.pyx"]), + ("flint.types.arb", ["src/flint/types/arb.pyx"]), + ("flint.types.arb_poly", ["src/flint/types/arb_poly.pyx"]), + ("flint.types.arb_mat", ["src/flint/types/arb_mat.pyx"]), + ("flint.types.arb_series", ["src/flint/types/arb_series.pyx"]), + ("flint.types.acb", ["src/flint/types/acb.pyx"]), + ("flint.types.acb_poly", ["src/flint/types/acb_poly.pyx"]), + ("flint.types.acb_mat", ["src/flint/types/acb_mat.pyx"]), + ("flint.types.acb_series", ["src/flint/types/acb_series.pyx"]), + ("flint.types.fmpz_mpoly", ["src/flint/types/fmpz_mpoly.pyx"]), + ("flint.types.dirichlet", ["src/flint/types/dirichlet.pyx"]), ("flint.flint_base.flint_base", ["src/flint/flint_base/flint_base.pyx"]), ("flint.flint_base.flint_context", ["src/flint/flint_base/flint_context.pyx"]), diff --git a/src/flint/__init__.py b/src/flint/__init__.py index 032778c8..68892edc 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -1,3 +1,24 @@ -from ._flint import * - +from .pyflint import * +from .types.fmpz import * +from .types.fmpz_poly import * +from .types.fmpz_mat import * +from .types.fmpz_series import * +from .types.fmpq import * +from .types.fmpq_poly import * +from .types.fmpq_mat import * +from .types.fmpq_series import * +from .types.nmod import * +from .types.nmod_poly import * +from .types.nmod_mat import * +from .types.nmod_series import * +from .types.arf import * +from .types.arb import * +from .types.arb_poly import * +from .types.arb_mat import * +from .types.arb_series import * +from .types.acb import * +from .types.acb_poly import * +from .types.acb_mat import * +from .types.acb_series import * +from .types.fmpz_mpoly import * __version__ = '0.4.2' diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 166e14a6..c0218e25 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -4,20 +4,22 @@ cdef extern from "Python.h": ctypedef void PyObject - ctypedef void PyTypeObject - ctypedef long Py_ssize_t - int PyObject_TypeCheck(object, PyTypeObject*) - int PyInt_Check(PyObject *o) - int PyLong_Check(PyObject *o) - long PyInt_AS_LONG(PyObject *io) - double PyFloat_AS_DOUBLE(PyObject *io) - Py_ssize_t PyList_GET_SIZE(PyObject *list) - long PyLong_AsLongAndOverflow(PyObject *pylong, int *overflow) - long long PyLong_AsLongLongAndOverflow(PyObject *pylong, int *overflow) +# ctypedef void PyTypeObject +# ctypedef long Py_ssize_t +# int PyObject_TypeCheck(object, PyTypeObject*) +# int PyInt_Check(PyObject *o) +# int PyLong_Check(PyObject *o) +# long PyInt_AS_LONG(PyObject *io) +# double PyFloat_AS_DOUBLE(PyObject *io) +# Py_ssize_t PyList_GET_SIZE(PyObject *list) +# long PyLong_AsLongAndOverflow(PyObject *pylong, int *overflow) +# long long PyLong_AsLongLongAndOverflow(PyObject *pylong, int *overflow) + +cdef enum: + FMPZ_UNKNOWN = 0 + FMPZ_REF = 1 + FMPZ_TMP = 2 -DEF FMPZ_UNKNOWN = 0 -DEF FMPZ_REF = 1 -DEF FMPZ_TMP = 2 # # Note: ulong and slong are used throughout Flint/Arb. They are expected to be @@ -68,2380 +70,6 @@ cdef extern from *: """ slong pylong_as_slong(PyObject *pylong, int *overflow) -cdef extern from "flint/nmod_vec.h": - ctypedef struct nmod_t: - mp_limb_t n - mp_limb_t ninv - mp_bitcnt_t norm - void nmod_init(nmod_t * mod, mp_limb_t n) - mp_limb_t nmod_add(mp_limb_t a, mp_limb_t b, nmod_t mod) - mp_limb_t nmod_sub(mp_limb_t a, mp_limb_t b, nmod_t mod) - mp_limb_t nmod_neg(mp_limb_t a, nmod_t mod) - mp_limb_t nmod_mul(mp_limb_t a, mp_limb_t b, nmod_t mod) - mp_limb_t nmod_div(mp_limb_t a, mp_limb_t b, nmod_t mod) - -cdef extern from "flint/nmod_poly.h": - ctypedef struct nmod_poly_struct: - mp_ptr coeffs - long alloc - long length - nmod_t mod - ctypedef nmod_poly_struct nmod_poly_t[1] - - ctypedef struct nmod_poly_factor_struct: - nmod_poly_struct *p - long *exp - long num - long alloc - ctypedef nmod_poly_factor_struct nmod_poly_factor_t[1] - - void nmod_poly_init(nmod_poly_t poly, mp_limb_t n) - void nmod_poly_init_preinv(nmod_poly_t poly, mp_limb_t n, mp_limb_t ninv) - void nmod_poly_init2(nmod_poly_t poly, mp_limb_t n, long alloc) - void nmod_poly_init2_preinv(nmod_poly_t poly, mp_limb_t n, mp_limb_t ninv, long alloc) - void nmod_poly_realloc(nmod_poly_t poly, long alloc) - void nmod_poly_clear(nmod_poly_t poly) - void nmod_poly_fit_length(nmod_poly_t poly, long alloc) - long nmod_poly_length(nmod_poly_t poly) - long nmod_poly_degree(nmod_poly_t poly) - mp_limb_t nmod_poly_modulus(nmod_poly_t poly) - mp_bitcnt_t nmod_poly_max_bits(nmod_poly_t poly) - void nmod_poly_set(nmod_poly_t a, nmod_poly_t b) - void nmod_poly_swap(nmod_poly_t poly1, nmod_poly_t poly2) - void nmod_poly_zero(nmod_poly_t res) - void nmod_poly_truncate(nmod_poly_t poly, long len) - void nmod_poly_reverse(nmod_poly_t output, nmod_poly_t input, long m) - void nmod_poly_randtest(nmod_poly_t poly, flint_rand_t state, long len) - ulong nmod_poly_get_coeff_ui(nmod_poly_t poly, ulong j) - void nmod_poly_set_coeff_ui(nmod_poly_t poly, ulong j, ulong c) - char * nmod_poly_get_str(nmod_poly_t poly) - int nmod_poly_set_str(char * s, nmod_poly_t poly) - int nmod_poly_print(nmod_poly_t a) - int nmod_poly_equal(nmod_poly_t a, nmod_poly_t b) - int nmod_poly_is_zero(nmod_poly_t poly) - void nmod_poly_shift_left(nmod_poly_t res, nmod_poly_t poly, long k) - void nmod_poly_shift_right(nmod_poly_t res, nmod_poly_t poly, long k) - void nmod_poly_add(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) - void nmod_poly_sub(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) - void nmod_poly_neg(nmod_poly_t res, nmod_poly_t poly1) - void nmod_poly_scalar_mul_nmod(nmod_poly_t res, nmod_poly_t poly1, mp_limb_t c) - void nmod_poly_make_monic(nmod_poly_t output, nmod_poly_t input) - void nmod_poly_mul(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) - void nmod_poly_mullow(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2, long trunc) - void nmod_poly_pow(nmod_poly_t res, nmod_poly_t poly, ulong e) - void nmod_poly_pow_trunc(nmod_poly_t res, nmod_poly_t poly, ulong e, long trunc) - void nmod_poly_divrem(nmod_poly_t Q, nmod_poly_t R, nmod_poly_t A, nmod_poly_t B) - void nmod_poly_div(nmod_poly_t Q, nmod_poly_t A, nmod_poly_t B) - void nmod_poly_inv_series(nmod_poly_t Qinv, nmod_poly_t Q, long n) - void nmod_poly_div_series(nmod_poly_t Q, nmod_poly_t A, nmod_poly_t B, long n) - void nmod_poly_derivative(nmod_poly_t x_prime, nmod_poly_t x) - void nmod_poly_integral(nmod_poly_t x_int, nmod_poly_t x) - mp_limb_t nmod_poly_evaluate_nmod(nmod_poly_t poly, mp_limb_t c) - void nmod_poly_compose(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) - void nmod_poly_gcd(nmod_poly_t G, nmod_poly_t A, nmod_poly_t B) - void nmod_poly_xgcd(nmod_poly_t G, nmod_poly_t S, nmod_poly_t T, nmod_poly_t A, nmod_poly_t B) - void nmod_poly_invsqrt_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_sqrt_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_atan_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_tan_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_asin_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_sin_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_cos_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_asinh_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_atanh_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_sinh_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_cosh_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_tanh_series(nmod_poly_t g, nmod_poly_t h, long n) - void nmod_poly_log_series(nmod_poly_t res, nmod_poly_t f, long n) - void nmod_poly_exp_series(nmod_poly_t f, nmod_poly_t h, long n) - - int nmod_poly_is_irreducible(nmod_poly_t f) - mp_limb_t nmod_poly_factor_with_berlekamp(nmod_poly_factor_t result, nmod_poly_t poly) - mp_limb_t nmod_poly_factor_with_cantor_zassenhaus(nmod_poly_factor_t result, nmod_poly_t poly) - mp_limb_t nmod_poly_factor(nmod_poly_factor_t result, nmod_poly_t input) - void nmod_poly_factor_init(nmod_poly_factor_t fac) - void nmod_poly_factor_clear(nmod_poly_factor_t fac) - -cdef extern from "flint/nmod_mat.h": - ctypedef struct nmod_mat_struct: - mp_limb_t * entries - long r - long c - mp_limb_t ** rows - nmod_t mod - ctypedef nmod_mat_struct nmod_mat_t[1] - mp_limb_t nmod_mat_entry(nmod_mat_t mat, long i, long j) - long nmod_mat_nrows(nmod_mat_t mat) - long nmod_mat_ncols(nmod_mat_t mat) - void _nmod_mat_set_mod(nmod_mat_t mat, mp_limb_t n) - void nmod_mat_init(nmod_mat_t mat, long rows, long cols, mp_limb_t n) - void nmod_mat_init_set(nmod_mat_t mat, nmod_mat_t src) - void nmod_mat_clear(nmod_mat_t mat) - void nmod_mat_randtest(nmod_mat_t mat, flint_rand_t state) - void nmod_mat_randfull(nmod_mat_t mat, flint_rand_t state) - void nmod_mat_randrank(nmod_mat_t, flint_rand_t state, long rank) - void nmod_mat_randops(nmod_mat_t mat, long count, flint_rand_t state) - void nmod_mat_randtril(nmod_mat_t mat, flint_rand_t state, int unit) - void nmod_mat_randtriu(nmod_mat_t mat, flint_rand_t state, int unit) - void nmod_mat_print_pretty(nmod_mat_t mat) - int nmod_mat_equal(nmod_mat_t mat1, nmod_mat_t mat2) - int nmod_mat_is_zero(nmod_mat_t mat) - int nmod_mat_is_empty(nmod_mat_t mat) - int nmod_mat_is_square(nmod_mat_t mat) - void nmod_mat_zero(nmod_mat_t mat) - void nmod_mat_set(nmod_mat_t B, nmod_mat_t A) - void nmod_mat_transpose(nmod_mat_t B, nmod_mat_t A) - void nmod_mat_add(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) - void nmod_mat_sub(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) - void nmod_mat_neg(nmod_mat_t B, nmod_mat_t A) - void nmod_mat_scalar_mul(nmod_mat_t B, nmod_mat_t A, mp_limb_t c) - void nmod_mat_mul(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) - void nmod_mat_mul_classical(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) - void nmod_mat_mul_strassen(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) - void nmod_mat_addmul(nmod_mat_t D, nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) - void nmod_mat_submul(nmod_mat_t D, nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) - mp_limb_t nmod_mat_det(nmod_mat_t A) - long nmod_mat_rank(nmod_mat_t A) - int nmod_mat_inv(nmod_mat_t B, nmod_mat_t A) - void nmod_mat_solve_tril(nmod_mat_t X, nmod_mat_t L, nmod_mat_t B, int unit) - void nmod_mat_solve_triu(nmod_mat_t X, nmod_mat_t U, nmod_mat_t B, int unit) - long nmod_mat_lu(long * P, nmod_mat_t A, int rank_check) - int nmod_mat_solve(nmod_mat_t X, nmod_mat_t A, nmod_mat_t B) - int nmod_mat_solve_vec(mp_ptr x, nmod_mat_t A, mp_srcptr b) - long nmod_mat_rref(nmod_mat_t A) - long nmod_mat_nullspace(nmod_mat_t X, nmod_mat_t A) - -cdef extern from "flint/ulong_extras.h": - ulong n_gcd(ulong n, ulong k) - int n_is_prime(ulong n) - -cdef extern from "flint/fmpz.h": - ctypedef fmpz_struct fmpz_t[1] - int COEFF_IS_MPZ(fmpz_struct v) - void fmpz_init(fmpz_t op) - void fmpz_clear(fmpz_t op) - long fmpz_get_si(fmpz_t f) - ulong fmpz_get_ui(fmpz_t f) - void fmpz_set_si(fmpz_t f, long val) - void fmpz_set_ui(fmpz_t f, ulong val) - #void fmpz_get_mpz(mpz_t x, fmpz_t f) - #void fmpz_set_mpz(fmpz_t f, mpz_t x) - int fmpz_set_str(fmpz_t f, char * str, int b) - int fmpz_abs_fits_ui( fmpz_t f) - void fmpz_zero(fmpz_t f) - void fmpz_one(fmpz_t f) - int fmpz_is_zero(fmpz_t f) - int fmpz_is_one( fmpz_t f) - int fmpz_is_pm1( fmpz_t f) - void fmpz_set(fmpz_t f, fmpz_t g) - int fmpz_equal(fmpz_t f, fmpz_t g) - int fmpz_read(fmpz_t f) - int fmpz_print(fmpz_t x) - size_t fmpz_sizeinbase( fmpz_t f, int b) - char * fmpz_get_str(char * str, int b, fmpz_t f) - void fmpz_swap(fmpz_t f, fmpz_t g) - int fmpz_cmp( fmpz_t f, fmpz_t g) - int fmpz_cmp_ui( fmpz_t f, ulong g) - int fmpz_cmp_si( fmpz_t f, long g) - int fmpz_cmpabs( fmpz_t f, fmpz_t g) - int fmpz_equal_si(const fmpz_t f, long g) - int fmpz_is_even(fmpz_t f) - int fmpz_is_odd(fmpz_t f) - mp_size_t fmpz_size(fmpz_t f) - int fmpz_sgn(fmpz_t f) - mp_bitcnt_t fmpz_bits(fmpz_t f) - void fmpz_neg(fmpz_t f1, fmpz_t f2) - void fmpz_abs(fmpz_t f1, fmpz_t f2) - void fmpz_add(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_sub(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_mul_ui(fmpz_t f, fmpz_t g, ulong x) - void fmpz_mul_si(fmpz_t f, fmpz_t g, long x) - void fmpz_mul(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_mul_2exp(fmpz_t f, fmpz_t g, ulong exp) - void fmpz_add_ui(fmpz_t f, fmpz_t g, ulong x) - void fmpz_sub_ui(fmpz_t f, fmpz_t g, ulong x) - void fmpz_addmul_ui(fmpz_t f, fmpz_t g, ulong x) - void fmpz_submul_ui(fmpz_t f, fmpz_t g, ulong x) - void fmpz_addmul(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_submul(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_pow_ui(fmpz_t f, fmpz_t g, ulong exp) - void fmpz_powm_ui(fmpz_t f, fmpz_t g, ulong exp, fmpz_t m) - void fmpz_powm(fmpz_t f, fmpz_t g, fmpz_t e, fmpz_t m) - int fmpz_pow_fmpz(fmpz_t f, const fmpz_t g, const fmpz_t x) - int fmpz_sqrtmod(fmpz_t b, fmpz_t a, fmpz_t p) - void fmpz_sqrt(fmpz_t f, fmpz_t g) - void fmpz_sqrtrem(fmpz_t f, fmpz_t r, fmpz_t g) - void fmpz_root(fmpz_t r, const fmpz_t f, long n) - ulong fmpz_fdiv_ui(fmpz_t g, ulong h) - ulong fmpz_mod_ui(fmpz_t f, fmpz_t g, ulong h) - void fmpz_mod(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_gcd(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_lcm(fmpz_t f, fmpz_t g, fmpz_t h) - int fmpz_invmod(fmpz_t f, fmpz_t g, fmpz_t h) - long fmpz_remove(fmpz_t rop, fmpz_t op, fmpz_t f) - void fmpz_divexact(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_divexact_si(fmpz_t f, fmpz_t g, long h) - void fmpz_divexact_ui(fmpz_t f, fmpz_t g, ulong h) - void fmpz_cdiv_q(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_cdiv_q_si(fmpz_t f, fmpz_t g, long h) - void fmpz_cdiv_q_ui(fmpz_t f, fmpz_t g, ulong h) - void fmpz_fdiv_qr(fmpz_t f, fmpz_t s, fmpz_t g, fmpz_t h) - void fmpz_fdiv_q(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_fdiv_r(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_fdiv_q_ui(fmpz_t f, fmpz_t g, ulong h) - void fmpz_fdiv_q_si(fmpz_t f, fmpz_t g, long h) - void fmpz_fdiv_q_2exp(fmpz_t f, fmpz_t g, ulong exp) - void fmpz_tdiv_q(fmpz_t f, fmpz_t g, fmpz_t h) - void fmpz_tdiv_q_ui(fmpz_t f, fmpz_t g, ulong h) - void fmpz_tdiv_q_si(fmpz_t f, fmpz_t g, long h) - double fmpz_get_d_2exp(long * exp, fmpz_t f) - void fmpz_mul2_uiui(fmpz_t f, fmpz_t g, ulong h1, ulong h2) - void fmpz_divexact2_uiui(fmpz_t f, fmpz_t g, ulong h1, ulong h2) - void fmpz_fac_ui(fmpz_t f, ulong n) - void fmpz_bin_uiui(fmpz_t res, ulong n, ulong k) - void fmpz_CRT_ui(fmpz_t out, fmpz_t r1, fmpz_t m1, ulong r2, ulong m2) - void fmpz_CRT_ui_unsigned(fmpz_t out, fmpz_t r1, fmpz_t m1, ulong r2, ulong m2) - void fmpz_set_ui_mod(fmpz_t f, mp_limb_t x, mp_limb_t m) - int fmpz_moebius_mu(const fmpz_t f) - void fmpz_fib_ui(fmpz_t f, ulong n) - void fmpz_rfac_ui(fmpz_t r, const fmpz_t x, ulong n) - void fmpz_rfac_uiui(fmpz_t r, ulong x, ulong n) - void fmpz_primorial(fmpz_t res, ulong n) - int fmpz_is_perfect_power(fmpz_t root, const fmpz_t f) - int fmpz_jacobi(const fmpz_t a, const fmpz_t p) - int fmpz_is_prime(const fmpz_t n) - int fmpz_is_probabprime(const fmpz_t n) - void fmpz_complement(fmpz_t r, const fmpz_t f) - void fmpz_and(fmpz_t r, const fmpz_t a, const fmpz_t b) - void fmpz_or(fmpz_t r, const fmpz_t a, const fmpz_t b) - void fmpz_xor(fmpz_t r, const fmpz_t a, const fmpz_t b) - -cdef extern from "flint/fmpz_factor.h": - ctypedef struct fmpz_factor_struct: - int sign - fmpz_struct * p - fmpz_struct * exp - long alloc - long num - ctypedef fmpz_factor_struct fmpz_factor_t[1] - void fmpz_factor_init(fmpz_factor_t factor) - void fmpz_factor_clear(fmpz_factor_t factor) - void fmpz_factor(fmpz_factor_t factor, fmpz_t n) - int fmpz_factor_trial_range(fmpz_factor_t factor, const fmpz_t n, ulong start, ulong num_primes) - void fmpz_factor_expand(fmpz_t n, const fmpz_factor_t factor) - void _fmpz_factor_append(fmpz_factor_t factor, const fmpz_t p, ulong exp) - void fmpz_factor_smooth(fmpz_factor_t factor, fmpz_t n, long bits, int proved) - -cdef extern from "flint/fmpz_poly.h": - ctypedef struct fmpz_poly_struct: - fmpz_struct * coeffs - long alloc - long length - ctypedef fmpz_poly_struct fmpz_poly_t[1] - - ctypedef struct fmpz_poly_factor_struct: - fmpz_struct c - fmpz_poly_struct *p - long *exp - long num - long alloc - ctypedef fmpz_poly_factor_struct fmpz_poly_factor_t[1] - - void fmpz_poly_init(fmpz_poly_t poly) - void fmpz_poly_init2(fmpz_poly_t poly, long alloc) - void fmpz_poly_realloc(fmpz_poly_t poly, long alloc) - void fmpz_poly_fit_length(fmpz_poly_t poly, long len) - void fmpz_poly_clear(fmpz_poly_t poly) - void _fmpz_poly_normalise(fmpz_poly_t poly) - void _fmpz_poly_set_length(fmpz_poly_t poly, long newlen) - long fmpz_poly_length(fmpz_poly_t poly) - long fmpz_poly_degree(fmpz_poly_t poly) - ulong fmpz_poly_max_limbs(fmpz_poly_t poly) - long fmpz_poly_max_bits(fmpz_poly_t poly) - void fmpz_poly_set(fmpz_poly_t poly1, fmpz_poly_t poly2) - void fmpz_poly_set_ui(fmpz_poly_t poly, ulong c) - void fmpz_poly_set_si(fmpz_poly_t poly, long c) - void fmpz_poly_set_fmpz(fmpz_poly_t poly, fmpz_t c) - #void fmpz_poly_set_mpz(fmpz_poly_t poly, mpz_t c) - int fmpz_poly_set_str(fmpz_poly_t poly, char * str) - char * fmpz_poly_get_str(fmpz_poly_t poly) - char * fmpz_poly_get_str_pretty(fmpz_poly_t poly, char * x) - fmpz_struct * fmpz_poly_get_coeff_ptr(fmpz_poly_t poly, long n) - void fmpz_poly_zero(fmpz_poly_t poly) - void fmpz_poly_one(fmpz_poly_t poly) - void fmpz_poly_zero_coeffs(fmpz_poly_t poly, long i, long j) - void fmpz_poly_swap(fmpz_poly_t poly1, fmpz_poly_t poly2) - void fmpz_poly_reverse(fmpz_poly_t res, fmpz_poly_t poly, long n) - void fmpz_poly_truncate(fmpz_poly_t poly, long newlen) - #void fmpz_poly_randtest(fmpz_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits) - #void fmpz_poly_randtest_unsigned(fmpz_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits) - #void fmpz_poly_randtest_not_zero(fmpz_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits) - long fmpz_poly_get_coeff_si(fmpz_poly_t poly, long n) - void fmpz_poly_set_coeff_si(fmpz_poly_t poly, long n, long x) - ulong fmpz_poly_get_coeff_ui(fmpz_poly_t poly, long n) - void fmpz_poly_set_coeff_ui(fmpz_poly_t poly, long n, ulong x) - void fmpz_poly_set_coeff_fmpz(fmpz_poly_t poly, long n, fmpz_t x) - void fmpz_poly_get_coeff_fmpz(fmpz_t x, fmpz_poly_t poly, long n) - int fmpz_poly_equal(fmpz_poly_t poly1, fmpz_poly_t poly2) - int fmpz_poly_is_zero(fmpz_poly_t poly) - int fmpz_poly_is_one(fmpz_poly_t op) - int fmpz_poly_is_unit(fmpz_poly_t op) - void fmpz_poly_add(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) - void fmpz_poly_sub(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) - void fmpz_poly_neg(fmpz_poly_t res, fmpz_poly_t poly) - void fmpz_poly_scalar_mul_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) - void fmpz_poly_scalar_mul_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) - void fmpz_poly_scalar_mul_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) - void fmpz_poly_scalar_addmul_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) - void fmpz_poly_scalar_submul_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) - void fmpz_poly_scalar_fdiv_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) - void fmpz_poly_scalar_fdiv_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) - void fmpz_poly_scalar_fdiv_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) - void fmpz_poly_scalar_tdiv_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) - void fmpz_poly_scalar_tdiv_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) - void fmpz_poly_scalar_tdiv_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) - void fmpz_poly_scalar_divexact_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) - void fmpz_poly_scalar_divexact_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) - void fmpz_poly_scalar_divexact_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) - void fmpz_poly_mul(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) - void fmpz_poly_mullow(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2, long n) - void fmpz_poly_mulhigh_n(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2, long n) - void fmpz_poly_pow(fmpz_poly_t res, fmpz_poly_t poly, ulong e) - void fmpz_poly_pow_trunc(fmpz_poly_t res, fmpz_poly_t poly, ulong e, long n) - void fmpz_poly_shift_left(fmpz_poly_t res, fmpz_poly_t poly, long n) - void fmpz_poly_shift_right(fmpz_poly_t res, fmpz_poly_t poly, long n) - void fmpz_poly_2norm(fmpz_t res, fmpz_poly_t poly) - void fmpz_poly_gcd(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) - void fmpz_poly_xgcd(fmpz_t r, fmpz_poly_t s, fmpz_poly_t t, fmpz_poly_t poly1, fmpz_poly_t poly2) - void fmpz_poly_content(fmpz_t res, fmpz_poly_t poly) - void fmpz_poly_primitive_part(fmpz_poly_t res, fmpz_poly_t poly) - void fmpz_poly_divrem(fmpz_poly_t Q, fmpz_poly_t R, fmpz_poly_t A, fmpz_poly_t B) - void fmpz_poly_div(fmpz_poly_t Q, fmpz_poly_t A, fmpz_poly_t B) - void fmpz_poly_rem(fmpz_poly_t R, fmpz_poly_t A, fmpz_poly_t B) - fmpz_poly_inv_series(fmpz_poly_t Qinv, fmpz_poly_t Q, long n) - void fmpz_poly_div_series(fmpz_poly_t Q, fmpz_poly_t A, fmpz_poly_t B, long n) - int fmpz_poly_divides(fmpz_poly_t q, fmpz_poly_t a, fmpz_poly_t b) - void fmpz_poly_derivative(fmpz_poly_t res, fmpz_poly_t poly) - void fmpz_poly_evaluate_fmpz(fmpz_t res, fmpz_poly_t f, fmpz_t a) - #void fmpz_poly_evaluate_mpq(mpq_t res, fmpz_poly_t f, mpq_t a) - mp_limb_t fmpz_poly_evaluate_mod(fmpz_poly_t poly, mp_limb_t a, mp_limb_t n) - void fmpz_poly_compose(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) - - void fmpz_poly_compose_series(fmpz_poly_t res, const fmpz_poly_t poly1, const fmpz_poly_t poly2, long n) - void fmpz_poly_revert_series(fmpz_poly_t Qinv, const fmpz_poly_t Q, long n) - - void fmpz_poly_signature(long * r1, long * r2, fmpz_poly_t poly) - int fmpz_poly_print(fmpz_poly_t poly) - int fmpz_poly_print_pretty(fmpz_poly_t poly, char * x) - void fmpz_poly_evaluate_fmpz_vec(fmpz_struct * res, fmpz_poly_t f, fmpz_struct * a, long n) - void fmpz_poly_interpolate_fmpz_vec(fmpz_poly_t poly, fmpz_struct * xs, fmpz_struct * ys, long n) - void fmpz_poly_get_nmod_poly(nmod_poly_t res, fmpz_poly_t poly) - void fmpz_poly_set_nmod_poly(fmpz_poly_t res, nmod_poly_t poly) - void fmpz_poly_set_nmod_poly_unsigned(fmpz_poly_t res, nmod_poly_t poly) - void fmpz_poly_cyclotomic(fmpz_poly_t, ulong) - void fmpz_poly_cos_minpoly(fmpz_poly_t, ulong) - void fmpz_poly_swinnerton_dyer(fmpz_poly_t, ulong) - int fmpz_poly_sqrt(fmpz_poly_t b, const fmpz_poly_t a) - -cdef extern from "flint/fmpz_poly_factor.h": - void fmpz_poly_factor_init(fmpz_poly_factor_t fac) - void fmpz_poly_factor_clear(fmpz_poly_factor_t fac) - void fmpz_poly_factor_zassenhaus(fmpz_poly_factor_t fac, fmpz_poly_t G) - void fmpz_poly_factor(fmpz_poly_factor_t fac, fmpz_poly_t G) - void fmpz_poly_factor_squarefree(fmpz_poly_factor_t fac, fmpz_poly_t G) - -cdef extern from "flint/fmpz_mat.h": - ctypedef struct fmpz_mat_struct: - fmpz_struct * entries - long r - long c - fmpz_struct ** rows - ctypedef fmpz_mat_struct fmpz_mat_t[1] - fmpz_struct * fmpz_mat_entry(fmpz_mat_t mat, long i, long j) - long fmpz_mat_nrows(fmpz_mat_t mat) - long fmpz_mat_ncols(fmpz_mat_t mat) - void fmpz_mat_init(fmpz_mat_t mat, long rows, long cols) - void fmpz_mat_init_set(fmpz_mat_t mat, fmpz_mat_t src) - void fmpz_mat_swap(fmpz_mat_t mat1, fmpz_mat_t mat2) - void fmpz_mat_set(fmpz_mat_t mat1, fmpz_mat_t mat2) - void fmpz_mat_clear(fmpz_mat_t mat) - int fmpz_mat_equal(fmpz_mat_t mat1, fmpz_mat_t mat2) - int fmpz_mat_is_zero( fmpz_mat_t mat) - int fmpz_mat_is_empty( fmpz_mat_t mat) - int fmpz_mat_is_square( fmpz_mat_t mat) - void fmpz_mat_zero(fmpz_mat_t mat) - void fmpz_mat_one(fmpz_mat_t mat) - void fmpz_mat_get_nmod_mat(nmod_mat_t mat, fmpz_mat_t mat2) - void fmpz_mat_randbits(fmpz_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) - void fmpz_mat_randtest(fmpz_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) - void fmpz_mat_randtest_unsigned(fmpz_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) - void fmpz_mat_randrank(fmpz_mat_t mat, flint_rand_t state, long rank, mp_bitcnt_t bits) - int fmpz_mat_print_pretty( fmpz_mat_t mat) - void fmpz_mat_transpose(fmpz_mat_t B, fmpz_mat_t A) - void fmpz_mat_add(fmpz_mat_t C, fmpz_mat_t A, fmpz_mat_t B) - void fmpz_mat_sub(fmpz_mat_t C, fmpz_mat_t A, fmpz_mat_t B) - void fmpz_mat_neg(fmpz_mat_t B, fmpz_mat_t A) - void fmpz_mat_scalar_mul_fmpz(fmpz_mat_t B, fmpz_mat_t A, fmpz_t c) - void fmpz_mat_scalar_mul_si(fmpz_mat_t B, fmpz_mat_t A, long c) - void fmpz_mat_scalar_mul_ui(fmpz_mat_t B, fmpz_mat_t A, ulong c) - void fmpz_mat_mul(fmpz_mat_t C, fmpz_mat_t A, fmpz_mat_t B) - void fmpz_mat_det(fmpz_t det, fmpz_mat_t A) - long fmpz_mat_rank(fmpz_mat_t A) - long fmpz_mat_rref(fmpz_mat_t R, fmpz_t den, fmpz_mat_t A) - void fmpz_mat_inv(fmpz_mat_t B, fmpz_t den, fmpz_mat_t A) - int fmpz_mat_solve(fmpz_mat_t X, fmpz_t den, fmpz_mat_t A, fmpz_mat_t B) - long fmpz_mat_nullspace(fmpz_mat_t res, fmpz_mat_t mat) - void fmpz_mat_pow(fmpz_mat_t A, fmpz_mat_t B, ulong e) - int fmpz_mat_is_hadamard(const fmpz_mat_t A) - int fmpz_mat_hadamard(fmpz_mat_t A) - - void fmpz_mat_hnf(fmpz_mat_t H, const fmpz_mat_t A) - void fmpz_mat_hnf_transform(fmpz_mat_t H, fmpz_mat_t U, const fmpz_mat_t A) - int fmpz_mat_is_in_hnf(const fmpz_mat_t A) - void fmpz_mat_snf(fmpz_mat_t S, const fmpz_mat_t A) - int fmpz_mat_is_in_snf(const fmpz_mat_t A) - - void fmpz_mat_charpoly(fmpz_poly_t cp, const fmpz_mat_t mat) - void fmpz_mat_minpoly(fmpz_poly_t cp, const fmpz_mat_t mat) - -cdef extern from "flint/fmpz_lll.h": - ctypedef struct fmpz_lll_struct: - double delta - double eta - int rt - int gt - - ctypedef fmpz_lll_struct fmpz_lll_t[1] - - void fmpz_lll_context_init(fmpz_lll_t fl, double delta, double eta, int rt, int gt) - void fmpz_lll(fmpz_mat_t B, fmpz_mat_t U, const fmpz_lll_t fl) - - -cdef extern from "flint/fmpq.h": - ctypedef struct fmpq_struct: - fmpz_struct num - fmpz_struct den - ctypedef fmpq_struct fmpq_t[1] - fmpz_struct * fmpq_numref(fmpq_t x) - fmpz_struct * fmpq_denref(fmpq_t x) - void fmpq_init(fmpq_t x) - void fmpq_clear(fmpq_t x) - void fmpq_zero(fmpq_t res) - void fmpq_one(fmpq_t res) - int fmpq_equal(fmpq_t x, fmpq_t y) - int fmpq_sgn(fmpq_t x) - int fmpq_is_zero(fmpq_t x) - int fmpq_is_one(fmpq_t x) - void fmpq_set(fmpq_t dest, fmpq_t src) - void fmpq_neg(fmpq_t dest, fmpq_t src) - void fmpq_canonicalise(fmpq_t res) - int fmpq_is_canonical(fmpq_t x) - void fmpq_set_si(fmpq_t res, long p, ulong q) - #void fmpq_set_mpq(fmpq_t dest, mpq_t src) - #void fmpq_get_mpq(mpq_t dest, fmpq_t src) - void fmpq_print(fmpq_t x) - void fmpq_randtest(fmpq_t res, flint_rand_t state, mp_bitcnt_t bits) - void fmpq_randbits(fmpq_t res, flint_rand_t state, mp_bitcnt_t bits) - void fmpq_add(fmpq_t res, fmpq_t op1, fmpq_t op2) - void fmpq_sub(fmpq_t res, fmpq_t op1, fmpq_t op2) - void fmpq_mul(fmpq_t res, fmpq_t op1, fmpq_t op2) - void fmpq_mul_fmpz(fmpq_t res, fmpq_t op, fmpz_t x) - void fmpq_addmul(fmpq_t res, fmpq_t op1, fmpq_t op2) - void fmpq_submul(fmpq_t res, fmpq_t op1, fmpq_t op2) - void fmpq_inv(fmpq_t dest, fmpq_t src) - void fmpq_div(fmpq_t res, fmpq_t op1, fmpq_t op2) - void fmpq_div_fmpz(fmpq_t res, fmpq_t op, fmpz_t x) - int fmpq_mod_fmpz(fmpz_t res, fmpq_t x, fmpz_t mod) - int fmpq_pow_fmpz(fmpq_t a, const fmpq_t b, const fmpz_t e) - int fmpq_reconstruct_fmpz(fmpq_t res, fmpz_t a, fmpz_t m) - int fmpq_reconstruct_fmpz_2(fmpq_t res, fmpz_t a, fmpz_t m, fmpz_t N, fmpz_t D) - mp_bitcnt_t fmpq_height_bits(fmpq_t x) - void fmpq_height(fmpz_t height, fmpq_t x) - void fmpq_next_calkin_wilf(fmpq_t res, fmpq_t x) - void fmpq_next_signed_calkin_wilf(fmpq_t res, fmpq_t x) - void fmpq_next_minimal(fmpq_t res, fmpq_t x) - void fmpq_next_signed_minimal(fmpq_t res, fmpq_t x) - void fmpq_harmonic_ui(fmpq_t res, ulong n) - void fmpq_dedekind_sum(fmpq_t s, const fmpz_t h, const fmpz_t k) - -cdef extern from "flint/fmpq_poly.h": - ctypedef struct fmpq_poly_struct: - fmpz_struct * coeffs - long alloc - long length - fmpz_t den - ctypedef fmpq_poly_struct fmpq_poly_t[1] - void fmpq_poly_init(fmpq_poly_t poly) - void fmpq_poly_init2(fmpq_poly_t poly, long alloc) - void fmpq_poly_realloc(fmpq_poly_t poly, long alloc) - void fmpq_poly_fit_length(fmpq_poly_t poly, long len) - void fmpq_poly_clear(fmpq_poly_t poly) - void _fmpq_poly_normalise(fmpq_poly_t poly) - void fmpq_poly_canonicalise(fmpq_poly_t poly) - int fmpq_poly_is_canonical(fmpq_poly_t poly) - fmpz_struct * fmpq_poly_numref(fmpq_poly_t poly) - fmpz_struct * fmpq_poly_denref(fmpq_poly_t poly) - void fmpq_poly_get_numerator(fmpz_poly_t res, fmpq_poly_t poly) - long fmpq_poly_degree(fmpq_poly_t poly) - long fmpq_poly_length(fmpq_poly_t poly) - void fmpq_poly_randtest(fmpq_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits_in) - void fmpq_poly_randtest_unsigned(fmpq_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits_in) - void fmpq_poly_randtest_not_zero(fmpq_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits_in) - void fmpq_poly_set(fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_set_si(fmpq_poly_t poly, long x) - void fmpq_poly_set_ui(fmpq_poly_t poly, ulong x) - void fmpq_poly_set_fmpz(fmpq_poly_t poly, fmpz_t x) - void fmpq_poly_set_fmpq(fmpq_poly_t poly, fmpq_t x) - #void fmpq_poly_set_mpz(fmpq_poly_t poly, mpz_t x) - #void fmpq_poly_set_mpq(fmpq_poly_t poly, mpq_t x) - void fmpq_poly_set_fmpz_poly(fmpq_poly_t rop, fmpz_poly_t op) - #void _fmpq_poly_set_array_mpq(fmpz_struct * poly, fmpz_t den, mpq_t * a, long n) - #void fmpq_poly_set_array_mpq(fmpq_poly_t poly, mpq_t * a, long n) - int fmpq_poly_set_str(fmpq_poly_t poly, char * str) - char * fmpq_poly_get_str(fmpq_poly_t poly) - char * fmpq_poly_get_str_pretty(fmpq_poly_t poly, char * var) - void fmpq_poly_zero(fmpq_poly_t poly) - void fmpq_poly_one(fmpq_poly_t poly) - void fmpq_poly_neg(fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_inv(fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_swap(fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_truncate(fmpq_poly_t poly, long n) - void fmpq_poly_get_coeff_fmpq(fmpq_t x, fmpq_poly_t poly, long n) - void fmpq_poly_set_coeff_si(fmpq_poly_t poly, long n, long x) - void fmpq_poly_set_coeff_ui(fmpq_poly_t poly, long n, ulong x) - void fmpq_poly_set_coeff_fmpz(fmpq_poly_t poly, long n, fmpz_t x) - void fmpq_poly_set_coeff_fmpq(fmpq_poly_t poly, long n, fmpq_t x) - #void fmpq_poly_set_coeff_mpz(fmpq_poly_t poly, long n, mpz_t x) - #void fmpq_poly_set_coeff_mpq(fmpq_poly_t poly, long n, mpq_t x) - int fmpq_poly_equal(fmpq_poly_t poly1, fmpq_poly_t poly2) - int fmpq_poly_cmp(fmpq_poly_t left, fmpq_poly_t right) - int fmpq_poly_is_zero(fmpq_poly_t poly) - int fmpq_poly_is_one(fmpq_poly_t poly) - void fmpq_poly_add(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_sub(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_scalar_mul_si(fmpq_poly_t rop, fmpq_poly_t op, long c) - void fmpq_poly_scalar_mul_ui(fmpq_poly_t rop, fmpq_poly_t op, ulong c) - void fmpq_poly_scalar_mul_fmpz(fmpq_poly_t rop, fmpq_poly_t op, fmpz_t c) - #void fmpq_poly_scalar_mul_mpz(fmpq_poly_t rop, fmpq_poly_t op, mpz_t c) - void fmpq_poly_scalar_mul_fmpq(fmpq_poly_t rop, fmpq_poly_t op, fmpq_t c) - void fmpq_poly_scalar_div_si(fmpq_poly_t rop, fmpq_poly_t op, long c) - void fmpq_poly_scalar_div_ui(fmpq_poly_t rop, fmpq_poly_t op, ulong c) - void fmpq_poly_scalar_div_fmpz(fmpq_poly_t rop, fmpq_poly_t op, fmpz_t c) - #void fmpq_poly_scalar_div_mpz(fmpq_poly_t rop, fmpq_poly_t op, mpz_t c) - void fmpq_poly_scalar_div_fmpq(fmpq_poly_t rop, fmpq_poly_t op, fmpq_t c) - void fmpq_poly_mul(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_mullow(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2, long n) - void fmpq_poly_addmul(fmpq_poly_t rop, fmpq_poly_t op1, fmpq_poly_t op2) - void fmpq_poly_submul(fmpq_poly_t rop, fmpq_poly_t op1, fmpq_poly_t op2) - void fmpq_poly_pow(fmpq_poly_t rpoly, fmpq_poly_t poly, ulong e) - void fmpq_poly_shift_left(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_shift_right(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_divrem(fmpq_poly_t Q, fmpq_poly_t R, fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_div(fmpq_poly_t Q, fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_gcd(fmpq_poly_t g, fmpq_poly_t a, fmpq_poly_t b) - void fmpq_poly_xgcd(fmpq_poly_t G, fmpq_poly_t S, fmpq_poly_t T, const fmpq_poly_t A, const fmpq_poly_t B) - void fmpq_poly_rem(fmpq_poly_t R, fmpq_poly_t poly1, fmpq_poly_t poly2) - void fmpq_poly_inv_series(fmpq_poly_t Qinv, fmpq_poly_t Q, long n) - void fmpq_poly_div_series(fmpq_poly_t Q, fmpq_poly_t A, fmpq_poly_t B, long n) - void fmpq_poly_derivative(fmpq_poly_t res, fmpq_poly_t poly) - void fmpq_poly_integral(fmpq_poly_t res, fmpq_poly_t poly) - void fmpq_poly_invsqrt_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_sqrt_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_log_series(fmpq_poly_t res, fmpq_poly_t f, long n) - void fmpq_poly_exp_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_atan_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_atanh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_asin_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_asinh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_tan_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_sin_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_cos_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_sinh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_cosh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_tanh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) - void fmpq_poly_evaluate_fmpz(fmpq_t res, fmpq_poly_t poly, fmpz_t a) - void fmpq_poly_evaluate_fmpq(fmpq_t res, fmpq_poly_t poly, fmpq_t a) - # void fmpq_poly_evaluate_mpq(mpq_t res, fmpq_poly_t poly, mpq_t a) - void fmpq_poly_interpolate_fmpz_vec(fmpq_poly_t poly, fmpz_struct * xs, fmpz_struct * ys, long n) - void fmpq_poly_compose(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) - #void fmpq_poly_rescale(fmpq_poly_t res, fmpq_poly_t poly, mpq_t x) - #void fmpq_poly_content(mpq_t res, fmpq_poly_t poly) - void fmpq_poly_primitive_part(fmpq_poly_t res, fmpq_poly_t poly) - int fmpq_poly_is_monic(fmpq_poly_t poly) - void fmpq_poly_make_monic(fmpq_poly_t res, fmpq_poly_t poly) - int fmpq_poly_is_squarefree(fmpq_poly_t poly) - int fmpq_poly_debug(fmpq_poly_t poly) - #int fmpq_poly_fprint(FILE * file, fmpq_poly_t poly) - int fmpq_poly_print(fmpq_poly_t poly) - int fmpq_poly_print_pretty(fmpq_poly_t poly, char * var) - #int fmpq_poly_fread(FILE * file, fmpq_poly_t poly) - int fmpq_poly_read(fmpq_poly_t poly) - void fmpq_poly_compose_series(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2, long n) - void fmpq_poly_revert_series(fmpq_poly_t res, fmpq_poly_t poly1, long n) - -cdef extern from "flint/fmpq_mat.h": - ctypedef struct fmpq_mat_struct: - fmpq_struct * entries - long r - long c - fmpq_struct ** rows - ctypedef fmpq_mat_struct fmpq_mat_t[1] - fmpq_struct * fmpq_mat_entry(fmpq_mat_t mat, long i, long j) - fmpz_struct * fmpq_mat_entry_num(fmpq_mat_t mat, long i, long j) - fmpz_struct * fmpq_mat_entry_den(fmpq_mat_t mat, long i, long j) - long fmpq_mat_nrows(fmpq_mat_t mat) - long fmpq_mat_ncols(fmpq_mat_t mat) - void fmpq_mat_init(fmpq_mat_t mat, long rows, long cols) - void fmpq_mat_clear(fmpq_mat_t mat) - void fmpq_mat_print(fmpq_mat_t mat) - void fmpq_mat_randbits(fmpq_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) - void fmpq_mat_randtest(fmpq_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) - void fmpq_mat_hilbert_matrix(fmpq_mat_t mat) - void fmpq_mat_set(fmpq_mat_t dest, fmpq_mat_t src) - void fmpq_mat_zero(fmpq_mat_t mat) - void fmpq_mat_one(fmpq_mat_t mat) - void fmpq_mat_add(fmpq_mat_t mat, fmpq_mat_t mat1, fmpq_mat_t mat2) - void fmpq_mat_sub(fmpq_mat_t mat, fmpq_mat_t mat1, fmpq_mat_t mat2) - void fmpq_mat_neg(fmpq_mat_t rop, fmpq_mat_t op) - void fmpq_mat_scalar_mul_fmpz(fmpq_mat_t rop, fmpq_mat_t op, fmpz_t x) - void fmpq_mat_scalar_div_fmpz(fmpq_mat_t rop, fmpq_mat_t op, fmpz_t x) - int fmpq_mat_equal(fmpq_mat_t mat1, fmpq_mat_t mat2) - int fmpq_mat_is_integral(fmpq_mat_t mat) - int fmpq_mat_is_zero(fmpq_mat_t mat) - int fmpq_mat_is_empty(fmpq_mat_t mat) - int fmpq_mat_is_square(fmpq_mat_t mat) - int fmpq_mat_get_fmpz_mat(fmpz_mat_t dest, fmpq_mat_t mat) - void fmpq_mat_get_fmpz_mat_entrywise(fmpz_mat_t num, fmpz_mat_t den, fmpq_mat_t mat) - void fmpq_mat_get_fmpz_mat_matwise(fmpz_mat_t num, fmpz_t den, fmpq_mat_t mat) - void fmpq_mat_get_fmpz_mat_rowwise(fmpz_mat_t num, fmpz_struct * den, fmpq_mat_t mat) - void fmpq_mat_get_fmpz_mat_colwise(fmpz_mat_t num, fmpz_struct * den, fmpq_mat_t mat) - void fmpq_mat_get_fmpz_mat_rowwise_2(fmpz_mat_t num, fmpz_mat_t num2, fmpz_struct * den, fmpq_mat_t mat, fmpq_mat_t mat2) - void fmpq_mat_get_fmpz_mat_mod_fmpz(fmpz_mat_t dest, fmpq_mat_t mat, fmpz_t mod) - void fmpq_mat_set_fmpz_mat(fmpq_mat_t dest, fmpz_mat_t src) - void fmpq_mat_set_fmpz_mat_div_fmpz(fmpq_mat_t X, fmpz_mat_t Xmod, fmpz_t div) - int fmpq_mat_set_fmpz_mat_mod_fmpz(fmpq_mat_t X, fmpz_mat_t Xmod, fmpz_t mod) - void fmpq_mat_mul(fmpq_mat_t C, fmpq_mat_t A, fmpq_mat_t B) - void fmpq_mat_mul_fmpz_mat(fmpq_mat_t C, fmpq_mat_t A, fmpz_mat_t B) - void fmpq_mat_mul_r_fmpz_mat(fmpq_mat_t C, fmpz_mat_t A, fmpq_mat_t B) - void fmpq_mat_det(fmpq_t det, fmpq_mat_t mat) - int fmpq_mat_solve_fraction_free(fmpq_mat_t X, fmpq_mat_t A, fmpq_mat_t B) - int fmpq_mat_solve_dixon(fmpq_mat_t X, fmpq_mat_t A, fmpq_mat_t B) - int fmpq_mat_solve_fmpz_mat(fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B) - int fmpq_mat_inv(fmpq_mat_t B, fmpq_mat_t A) - long fmpq_mat_rref(fmpq_mat_t B, fmpq_mat_t A) - void fmpq_mat_transpose(fmpq_mat_t B, fmpq_mat_t A) - - void fmpq_mat_charpoly(fmpq_poly_t cp, const fmpq_mat_t mat) - void fmpq_mat_minpoly(fmpq_poly_t cp, const fmpq_mat_t mat) - - -cdef extern from "flint/arith.h": - void arith_number_of_partitions(fmpz_t res, ulong n) - int arith_moebius_mu(fmpz_t n) - void arith_divisor_sigma(fmpz_t v, ulong k, fmpz_t n) - void arith_euler_phi(fmpz_t v, fmpz_t n) - void arith_bell_number(fmpz_t v, ulong n) - void arith_euler_number(fmpz_t v, ulong n) - void arith_bernoulli_number(fmpq_t v, ulong n) - void arith_stirling_number_1(fmpz_t s, long n, long k) - void arith_stirling_number_2(fmpz_t s, long n, long k) - void arith_harmonic_number(fmpq_t v, ulong n) - void arith_bernoulli_polynomial(fmpq_poly_t v, ulong n) - void arith_euler_polynomial(fmpq_poly_t v, ulong n) - void arith_legendre_polynomial(fmpq_poly_t v, ulong n) - void arith_chebyshev_t_polynomial(fmpz_poly_t v, ulong n) - void arith_chebyshev_u_polynomial(fmpz_poly_t v, ulong n) - void arith_cyclotomic_polynomial(fmpz_poly_t v, ulong n) - -cdef extern from "mag.h": - ctypedef struct mag_struct: - fmpz_struct exp - mp_limb_t man - ctypedef mag_struct mag_t[1] - ctypedef mag_struct * mag_ptr - ctypedef const mag_struct * mag_srcptr - - void mag_init(mag_t x) - void mag_clear(mag_t x) - void mag_zero(mag_t x) - void mag_set(mag_t x, const mag_t y) - void mag_set_ui_2exp_si(mag_t x, ulong v, long e) - void mag_hypot(mag_t x, const mag_t y, const mag_t z) - -cdef extern from "arf.h": - ctypedef struct arf_struct: - fmpz_struct exp - long size - mp_limb_t d0 - mp_limb_t d1 - - ctypedef arf_struct arf_t[1] - ctypedef arf_struct * arf_ptr - ctypedef const arf_struct * arf_srcptr - - ctypedef int arf_rnd_t - cdef arf_rnd_t ARF_RND_DOWN - cdef arf_rnd_t ARF_RND_NEAR - cdef arf_rnd_t ARF_RND_FLOOR - cdef arf_rnd_t ARF_RND_CEIL - cdef arf_rnd_t ARF_RND_UP - - void arf_init(arf_t x) - void arf_clear(arf_t x) - void arf_zero(arf_t x) - void arf_pos_inf(arf_t x) - void arf_neg_inf(arf_t x) - void arf_nan(arf_t x) - int arf_is_special(const arf_t x) - int arf_is_zero(const arf_t x) - int arf_is_pos_inf(const arf_t x) - int arf_is_neg_inf(const arf_t x) - int arf_is_nan(const arf_t x) - int arf_is_normal(const arf_t x) - int arf_is_finite(const arf_t x) - int arf_is_inf(const arf_t x) - void arf_one(arf_t x) - int arf_is_one(const arf_t x) - int arf_sgn(const arf_t x) - int arf_cmp(const arf_t x, const arf_t y) - int arf_cmpabs(const arf_t x, const arf_t y) - void arf_swap(arf_t y, arf_t x) - void arf_set(arf_t y, const arf_t x) - void arf_neg(arf_t y, const arf_t x) - void arf_init_set_ui(arf_t x, ulong v) - void arf_init_set_si(arf_t x, long v) - void arf_set_ui(arf_t x, ulong v) - void arf_set_si(arf_t x, long v) - int arf_cmpabs_ui(const arf_t x, ulong y) - void arf_init_set_shallow(arf_t z, const arf_t x) - void arf_init_neg_shallow(arf_t z, const arf_t x) - void arf_init_set_mag_shallow(arf_t y, const mag_t x) - void arf_init_neg_mag_shallow(arf_t z, const mag_t x) - int arf_cmpabs_mag(const arf_t x, const mag_t y) - int arf_mag_cmpabs(const mag_t x, const arf_t y) - void arf_set_fmpz(arf_t y, const fmpz_t x) - int arf_set_round_ui(arf_t x, ulong v, long prec, arf_rnd_t rnd) - int arf_set_round_si(arf_t x, long v, long prec, arf_rnd_t rnd) - int arf_set_round_fmpz(arf_t y, const fmpz_t x, long prec, arf_rnd_t rnd) - int arf_set_round(arf_t y, const arf_t x, long prec, arf_rnd_t rnd) - int arf_neg_round(arf_t y, const arf_t x, long prec, arf_rnd_t rnd) - int arf_equal(const arf_t x, const arf_t y) - void arf_min(arf_t z, const arf_t a, const arf_t b) - void arf_max(arf_t z, const arf_t a, const arf_t b) - void arf_abs(arf_t y, const arf_t x) - long arf_bits(const arf_t x) - void arf_bot(fmpz_t e, const arf_t x) - int arf_is_int(const arf_t x) - int arf_is_int_2exp_si(const arf_t x, long e) - int arf_cmp_2exp_si(const arf_t x, long e) - int arf_cmpabs_2exp_si(const arf_t x, long e) - void arf_set_si_2exp_si(arf_t x, long man, long exp) - void arf_set_ui_2exp_si(arf_t x, ulong man, long exp) - void arf_mul_2exp_si(arf_t y, const arf_t x, long e) - void arf_mul_2exp_fmpz(arf_t y, const arf_t x, const fmpz_t e) - int arf_set_round_fmpz_2exp(arf_t y, const fmpz_t x, const fmpz_t exp, long prec, arf_rnd_t rnd) - void arf_abs_bound_lt_2exp_fmpz(fmpz_t b, const arf_t x) - void arf_abs_bound_le_2exp_fmpz(fmpz_t b, const arf_t x) - long arf_abs_bound_lt_2exp_si(const arf_t x) - void arf_get_fmpz_2exp(fmpz_t man, fmpz_t exp, const arf_t x) - void arf_get_fmpz(fmpz_t z, const arf_t x, arf_rnd_t rnd) - long arf_get_si(const arf_t x, arf_rnd_t rnd) - int arf_get_fmpz_fixed_fmpz(fmpz_t y, const arf_t x, const fmpz_t e) - int arf_get_fmpz_fixed_si(fmpz_t y, const arf_t x, long e) - void arf_set_fmpz_2exp(arf_t x, const fmpz_t man, const fmpz_t exp) - void arf_floor(arf_t z, const arf_t x) - void arf_ceil(arf_t z, const arf_t x) - void arf_debug(const arf_t x) - void arf_print(const arf_t x) - void arf_printd(const arf_t y, long d) - void arf_randtest(arf_t x, flint_rand_t state, long bits, long mag_bits) - void arf_randtest_not_zero(arf_t x, flint_rand_t state, long bits, long mag_bits) - void arf_randtest_special(arf_t x, flint_rand_t state, long bits, long mag_bits) - int arf_mul(arf_t z, const arf_t x, const arf_t y, long prec, arf_rnd_t rnd) - int arf_neg_mul(arf_t z, const arf_t x, const arf_t y, long prec, arf_rnd_t rnd) - int arf_mul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) - int arf_mul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) - int arf_mul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) - int arf_add(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_add_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) - int arf_add_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) - int arf_add_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) - int arf_add_fmpz_2exp(arf_ptr z, arf_srcptr x, const fmpz_t y, const fmpz_t exp, long prec, arf_rnd_t rnd) - int arf_sub(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_sub_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) - int arf_sub_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) - int arf_sub_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) - int arf_addmul(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_addmul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) - int arf_addmul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) - int arf_addmul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) - int arf_submul(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_submul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) - int arf_submul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) - int arf_submul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) - int arf_div(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_div_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) - int arf_ui_div(arf_ptr z, ulong x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_div_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) - int arf_si_div(arf_ptr z, long x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_div_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) - int arf_fmpz_div(arf_ptr z, const fmpz_t x, arf_srcptr y, long prec, arf_rnd_t rnd) - int arf_fmpz_div_fmpz(arf_ptr z, const fmpz_t x, const fmpz_t y, long prec, arf_rnd_t rnd) - int arf_sqrt(arf_ptr z, arf_srcptr x, long prec, arf_rnd_t rnd) - int arf_sqrt_ui(arf_t z, ulong x, long prec, arf_rnd_t rnd) - int arf_sqrt_fmpz(arf_t z, const fmpz_t x, long prec, arf_rnd_t rnd) - int arf_rsqrt(arf_ptr z, arf_srcptr x, long prec, arf_rnd_t rnd) - void arf_get_mag(mag_t y, const arf_t x) - void arf_get_mag_lower(mag_t y, const arf_t x) - void arf_set_mag(arf_t y, const mag_t x) - void mag_init_set_arf(mag_t y, const arf_t x) - void arf_mag_add_ulp(mag_t z, const mag_t x, const arf_t y, long prec) - void arf_mag_set_ulp(mag_t z, const arf_t y, long prec) - void arf_get_fmpq(fmpq_t y, const arf_t x) - int arf_set_fmpq(arf_t y, const fmpq_t x, long prec, arf_rnd_t rnd) - double arf_get_d(const arf_t x, arf_rnd_t rnd) - void arf_set_d(arf_t x, double v) - -cdef extern from "arb.h": - ctypedef struct arb_struct: - arf_struct mid - mag_struct rad - - ctypedef arb_struct * arb_ptr - ctypedef const arb_struct * arb_srcptr - ctypedef arb_struct arb_t[1] - - arf_ptr arb_midref(const arb_t x) - mag_ptr arb_radref(const arb_t x) - - void arb_init(arb_t x) - void arb_clear(arb_t x) - - void arb_init(arb_t x) - void arb_clear(arb_t x) - int arb_is_exact(const arb_t x) - int arb_equal(const arb_t x, const arb_t y) - int arb_eq(const arb_t x, const arb_t y) - int arb_ne(const arb_t x, const arb_t y) - int arb_lt(const arb_t x, const arb_t y) - int arb_le(const arb_t x, const arb_t y) - int arb_gt(const arb_t x, const arb_t y) - int arb_ge(const arb_t x, const arb_t y) - void arb_zero(arb_t x) - int arb_is_zero(const arb_t x) - void arb_pos_inf(arb_t x) - void arb_neg_inf(arb_t x) - void arb_zero_pm_inf(arb_t x) - void arb_indeterminate(arb_t x) - int arb_is_finite(const arb_t x) - void arb_set(arb_t x, const arb_t y) - void arb_swap(arb_t x, arb_t y) - void arb_set_round(arb_t z, const arb_t x, long prec) - void arb_trim(arb_t y, const arb_t x) - void arb_neg(arb_t x, const arb_t y) - void arb_neg_round(arb_t x, const arb_t y, long prec) - void arb_abs(arb_t x, const arb_t y) - void arb_sgn(arb_t x, const arb_t y) - void arb_set_arf(arb_t x, const arf_t y) - void arb_set_si(arb_t x, long y) - void arb_set_ui(arb_t x, ulong y) - void arb_set_fmpz(arb_t x, const fmpz_t y) - void arb_set_fmpz_2exp(arb_t x, const fmpz_t y, const fmpz_t exp) - void arb_set_round_fmpz_2exp(arb_t y, const fmpz_t x, const fmpz_t exp, long prec) - void arb_set_round_fmpz(arb_t y, const fmpz_t x, long prec) - int arb_is_one(const arb_t f) - void arb_one(arb_t f) - void arb_print(const arb_t x) - void arb_printd(const arb_t x, long digits) - void arb_mul_2exp_si(arb_t y, const arb_t x, long e) - void arb_mul_2exp_fmpz(arb_t y, const arb_t x, const fmpz_t e) - int arb_is_int(const arb_t x) - int arb_contains_zero(const arb_t x) - int arb_is_nonzero(const arb_t x) - int arb_is_positive(const arb_t x) - int arb_is_nonnegative(const arb_t x) - int arb_is_negative(const arb_t x) - int arb_is_nonpositive(const arb_t x) - int arb_contains_negative(const arb_t x) - int arb_contains_nonpositive(const arb_t x) - int arb_contains_positive(const arb_t x) - int arb_contains_nonnegative(const arb_t x) - int arb_contains_int(const arb_t x) - void arb_get_mag_lower(mag_t z, const arb_t x) - void arb_get_mag_lower_nonnegative(mag_t z, const arb_t x) - void arb_get_mag(mag_t z, const arb_t x) - void arb_get_abs_ubound_arf(arf_t u, const arb_t x, long prec) - void arb_get_abs_lbound_arf(arf_t u, const arb_t x, long prec) - void arb_get_ubound_arf(arf_t u, const arb_t z, long prec) - void arb_get_lbound_arf(arf_t u, const arb_t z, long prec) - void arb_nonnegative_part(arb_t u, const arb_t x) - slong arb_rel_error_bits(const arb_t x) - slong arb_rel_accuracy_bits(const arb_t x) - long arb_bits(const arb_t x) - void arb_randtest_exact(arb_t x, flint_rand_t state, long prec, long mag_bits) - void arb_randtest_wide(arb_t x, flint_rand_t state, long prec, long mag_bits) - void arb_randtest_precise(arb_t x, flint_rand_t state, long prec, long mag_bits) - void arb_randtest(arb_t x, flint_rand_t state, long prec, long mag_bits) - void arb_randtest_special(arb_t x, flint_rand_t state, long prec, long mag_bits) - void arb_add_error_arf(arb_t x, const arf_t err) - void arb_add_error_2exp_si(arb_t x, long err) - void arb_add_error_2exp_fmpz(arb_t x, const fmpz_t err) - void arb_add_error(arb_t x, const arb_t error) - void arb_add_error_mag(arb_t x, const mag_t err) - int arb_contains_arf(const arb_t x, const arf_t y) - int arb_contains_fmpq(const arb_t x, const fmpq_t y) - int arb_contains_fmpz(const arb_t x, const fmpz_t y) - int arb_contains_si(const arb_t x, long y) - int arb_overlaps(const arb_t x, const arb_t y) - int arb_contains(const arb_t x, const arb_t y) - int arb_contains_interior(const arb_t x, const arb_t y) - void arb_get_interval_fmpz_2exp(fmpz_t a, fmpz_t b, fmpz_t exp, const arb_t x) - int arb_get_unique_fmpz(fmpz_t z, const arb_t x) - void arb_get_fmpz_mid_rad_10exp(fmpz_t mid, fmpz_t rad, fmpz_t exp, const arb_t x, long n) - - int arb_set_str(arb_t res, const char * inp, long prec) - - void arb_floor(arb_t z, const arb_t x, long prec) - void arb_ceil(arb_t z, const arb_t x, long prec) - void arb_set_interval_arf(arb_t x, const arf_t a, const arf_t b, long prec) - void arb_get_interval_arf(arf_t a, arf_t b, const arb_t x, long prec) - void arb_union(arb_t z, const arb_t x, const arb_t y, long prec) - int arb_intersection(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_min(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_max(arb_t z, const arb_t x, const arb_t y, long prec) - - void arb_get_rand_fmpq(fmpq_t q, flint_rand_t state, const arb_t x, long bits) - - void arb_add(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_add_arf(arb_t z, const arb_t x, const arf_t y, long prec) - void arb_add_ui(arb_t z, const arb_t x, ulong y, long prec) - void arb_add_si(arb_t z, const arb_t x, long y, long prec) - void arb_add_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) - void arb_add_fmpz_2exp(arb_t z, const arb_t x, const fmpz_t man, const fmpz_t exp, long prec) - - void arb_sub(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_sub_arf(arb_t z, const arb_t x, const arf_t y, long prec) - void arb_sub_ui(arb_t z, const arb_t x, ulong y, long prec) - void arb_sub_si(arb_t z, const arb_t x, long y, long prec) - void arb_sub_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) - - void arb_mul(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_mul_arf(arb_t z, const arb_t x, const arf_t y, long prec) - void arb_mul_si(arb_t z, const arb_t x, long y, long prec) - void arb_mul_ui(arb_t z, const arb_t x, ulong y, long prec) - void arb_mul_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) - - void arb_addmul(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_addmul_arf(arb_t z, const arb_t x, const arf_t y, long prec) - void arb_addmul_si(arb_t z, const arb_t x, long y, long prec) - void arb_addmul_ui(arb_t z, const arb_t x, ulong y, long prec) - void arb_addmul_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) - - void arb_submul(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_submul_arf(arb_t z, const arb_t x, const arf_t y, long prec) - void arb_submul_si(arb_t z, const arb_t x, long y, long prec) - void arb_submul_ui(arb_t z, const arb_t x, ulong y, long prec) - void arb_submul_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) - - void arb_div(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_div_arf(arb_t z, const arb_t x, const arf_t y, long prec) - void arb_div_si(arb_t z, const arb_t x, long y, long prec) - void arb_div_ui(arb_t z, const arb_t x, ulong y, long prec) - void arb_div_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) - void arb_fmpz_div_fmpz(arb_t z, const fmpz_t x, const fmpz_t y, long prec) - void arb_ui_div(arb_t z, ulong x, const arb_t y, long prec) - - void arb_inv(arb_t y, const arb_t x, long prec) - void arb_set_fmpq(arb_t y, const fmpq_t x, long prec) - - void arb_sqrt(arb_t z, const arb_t x, long prec) - void arb_sqrt_arf(arb_t z, const arf_t x, long prec) - void arb_sqrt_fmpz(arb_t z, const fmpz_t x, long prec) - void arb_sqrt_ui(arb_t z, ulong x, long prec) - - void arb_sqrtpos(arb_t z, const arb_t x, long prec) - void arb_hypot(arb_t z, const arb_t x, const arb_t y, long prec) - - void arb_rsqrt(arb_t z, const arb_t x, long prec) - void arb_rsqrt_ui(arb_t z, ulong x, long prec) - - void arb_pow_fmpz_binexp(arb_t y, const arb_t b, const fmpz_t e, long prec) - void arb_pow_fmpz(arb_t y, const arb_t b, const fmpz_t e, long prec) - void arb_pow_ui(arb_t y, const arb_t b, ulong e, long prec) - void arb_ui_pow_ui(arb_t y, ulong b, ulong e, long prec) - void arb_si_pow_ui(arb_t y, long b, ulong e, long prec) - void arb_pow_fmpq(arb_t y, const arb_t x, const fmpq_t a, long prec) - - void arb_div_2expm1_ui(arb_t z, const arb_t x, ulong n, long prec) - void arb_pow(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_root(arb_t z, const arb_t x, ulong k, long prec) - void arb_log(arb_t z, const arb_t x, long prec) - void arb_log_arf(arb_t z, const arf_t x, long prec) - void arb_log_ui(arb_t z, ulong x, long prec) - void arb_log_fmpz(arb_t z, const fmpz_t x, long prec) - void arb_log1p(arb_t z, const arb_t x, long prec) - void arb_exp(arb_t z, const arb_t x, long prec) - void arb_expm1(arb_t z, const arb_t x, long prec) - void arb_sin(arb_t s, const arb_t x, long prec) - void arb_cos(arb_t c, const arb_t x, long prec) - void arb_sin_cos(arb_t s, arb_t c, const arb_t x, long prec) - void arb_sin_pi(arb_t s, const arb_t x, long prec) - void arb_cos_pi(arb_t c, const arb_t x, long prec) - void arb_sin_cos_pi(arb_t s, arb_t c, const arb_t x, long prec) - void arb_tan(arb_t y, const arb_t x, long prec) - void arb_cot(arb_t y, const arb_t x, long prec) - void arb_sec(arb_t y, const arb_t x, long prec) - void arb_csc(arb_t y, const arb_t x, long prec) - void arb_tan_pi(arb_t y, const arb_t x, long prec) - void arb_cot_pi(arb_t y, const arb_t x, long prec) - void arb_sin_cos_pi_fmpq(arb_t s, arb_t c, const fmpq_t x, long prec) - void arb_sin_pi_fmpq(arb_t s, const fmpq_t x, long prec) - void arb_cos_pi_fmpq(arb_t c, const fmpq_t x, long prec) - void arb_sinc(arb_t s, const arb_t x, long prec) - void arb_sinc_pi(arb_t s, const arb_t x, long prec) - void arb_sinh(arb_t z, const arb_t x, long prec) - void arb_cosh(arb_t z, const arb_t x, long prec) - void arb_sinh_cosh(arb_t s, arb_t c, const arb_t x, long prec) - void arb_tanh(arb_t y, const arb_t x, long prec) - void arb_coth(arb_t y, const arb_t x, long prec) - void arb_sech(arb_t y, const arb_t x, long prec) - void arb_csch(arb_t y, const arb_t x, long prec) - void arb_atan_arf(arb_t z, const arf_t x, long prec) - void arb_atan(arb_t z, const arb_t x, long prec) - void arb_atan2(arb_t z, const arb_t b, const arb_t a, long prec) - void arb_asin(arb_t z, const arb_t x, long prec) - void arb_acos(arb_t z, const arb_t x, long prec) - void arb_atanh(arb_t z, const arb_t x, long prec) - void arb_asinh(arb_t z, const arb_t x, long prec) - void arb_acosh(arb_t z, const arb_t x, long prec) - void arb_fac_ui(arb_t z, ulong n, long prec) - void arb_bin_ui(arb_t z, const arb_t n, ulong k, long prec) - void arb_bin_uiui(arb_t z, ulong n, ulong k, long prec) - void arb_fib_fmpz(arb_t z, const fmpz_t n, long prec) - void arb_fib_ui(arb_t z, ulong n, long prec) - void arb_const_pi(arb_t z, long prec) - void arb_const_sqrt_pi(arb_t z, long prec) - void arb_const_log_sqrt2pi(arb_t z, long prec) - void arb_const_log2(arb_t z, long prec) - void arb_const_log10(arb_t z, long prec) - void arb_const_euler(arb_t z, long prec) - void arb_const_catalan(arb_t z, long prec) - void arb_const_e(arb_t z, long prec) - void arb_const_khinchin(arb_t z, long prec) - void arb_const_glaisher(arb_t z, long prec) - void arb_agm(arb_t z, const arb_t x, const arb_t y, long prec) - void arb_lgamma(arb_t z, const arb_t x, long prec) - void arb_rgamma(arb_t z, const arb_t x, long prec) - void arb_gamma(arb_t z, const arb_t x, long prec) - void arb_gamma_fmpq(arb_t z, const fmpq_t x, long prec) - void arb_gamma_fmpz(arb_t z, const fmpz_t x, long prec) - void arb_digamma(arb_t y, const arb_t x, long prec) - void arb_zeta(arb_t z, const arb_t s, long prec) - void arb_zeta_ui(arb_t z, ulong n, long prec) - void arb_bernoulli_ui(arb_t z, ulong n, long prec) - void arb_bernoulli_fmpz(arb_t z, const fmpz_t n, long prec) - void arb_bernoulli_poly_ui(arb_t z, ulong n, const arb_t x, long prec) - void arb_hurwitz_zeta(arb_t z, const arb_t s, const arb_t a, long prec) - - void arb_bell_fmpz(arb_t z, const fmpz_t n, long prec) - - void arb_partitions_fmpz(arb_t z, const fmpz_t n, long prec) - void arb_partitions_ui(arb_t z, ulong n, long prec) - - void arb_lambertw(arb_t z, const arb_t x, int flags, long prec) - - - void arb_rising_ui_bs(arb_t y, const arb_t x, ulong n, long prec) - void arb_rising_ui_rs(arb_t y, const arb_t x, ulong n, ulong m, long prec) - void arb_rising_ui_rec(arb_t y, const arb_t x, ulong n, long prec) - void arb_rising_ui(arb_t z, const arb_t x, ulong n, long prec) - void arb_rising_fmpq_ui(arb_t y, const fmpq_t x, ulong n, long prec) - void arb_rising(arb_t y, const arb_t x, const arb_t n, long prec) - - void arb_rising2_ui_rs(arb_t u, arb_t v, const arb_t x, ulong n, ulong m, long prec) - void arb_rising2_ui_bs(arb_t u, arb_t v, const arb_t x, ulong n, long prec) - void arb_rising2_ui(arb_t u, arb_t v, const arb_t x, ulong n, long prec) - - void arb_log_ui_from_prev(arb_t s, ulong k, arb_t log_prev, ulong prev, long prec) - - void arb_const_apery(arb_t s, long prec) - - void arb_zeta_ui_asymp(arb_t x, ulong s, long prec) - void arb_zeta_ui_borwein_bsplit(arb_t x, ulong s, long prec) - void arb_zeta_ui_euler_product(arb_t z, ulong s, long prec) - void arb_zeta_ui_bernoulli(arb_t x, ulong n, long prec) - void arb_zeta_ui_vec_borwein(arb_ptr z, ulong start, long num, ulong step, long prec) - void arb_zeta_ui(arb_t x, ulong n, long prec) - void arb_zeta_ui_vec_even(arb_ptr x, ulong start, long num, long prec) - void arb_zeta_ui_vec_odd(arb_ptr x, ulong start, long num, long prec) - void arb_zeta_ui_vec(arb_ptr x, ulong start, long num, long prec) - void arb_bernoulli_ui(arb_t b, ulong n, long prec) - void arb_bernoulli_ui_zeta(arb_t b, ulong n, long prec) - - void arb_polylog(arb_t w, const arb_t s, const arb_t z, long prec) - void arb_polylog_si(arb_t w, long s, const arb_t z, long prec) - - void arb_chebyshev_t_ui(arb_t a, ulong n, const arb_t x, long prec) - void arb_chebyshev_t2_ui(arb_t a, arb_t b, ulong n, const arb_t x, long prec) - void arb_chebyshev_u_ui(arb_t a, ulong n, const arb_t x, long prec) - void arb_chebyshev_u2_ui(arb_t a, arb_t b, ulong n, const arb_t x, long prec) - - void arb_root_ui(arb_t z, const arb_t x, ulong k, long prec) - - cdef ulong ARB_STR_MORE - cdef ulong ARB_STR_NO_RADIUS - cdef ulong ARB_STR_CONDENSE - char * arb_get_str(const arb_t x, long n, ulong flags) - -cdef extern from "acb.h": - ctypedef struct acb_struct: - arb_struct real - arb_struct imag - - ctypedef acb_struct * acb_ptr - ctypedef const acb_struct * acb_srcptr - ctypedef acb_struct acb_t[1] - - arb_ptr acb_realref(const acb_t x) - arb_ptr acb_imagref(const acb_t x) - - acb_ptr _acb_vec_init(long n) - void _acb_vec_clear(acb_ptr v, long n) - void _acb_vec_sort_pretty(acb_ptr vec, long len) - void acb_printd(const acb_t z, long digits) - - void acb_init(acb_t x) - void acb_clear(acb_t x) - int acb_is_zero(const acb_t z) - int acb_is_one(const acb_t z) - int acb_is_exact(const acb_t z) - int acb_is_finite(const acb_t x) - void acb_indeterminate(acb_t x) - void acb_zero(acb_t z) - void acb_one(acb_t z) - void acb_onei(acb_t z) - void acb_set(acb_t z, const acb_t x) - void acb_set_round(acb_t z, const acb_t x, long prec) - void acb_neg_round(acb_t z, const acb_t x, long prec) - void acb_swap(acb_t z, acb_t x) - int acb_equal(const acb_t x, const acb_t y) - int acb_eq(const acb_t x, const acb_t y) - int acb_ne(const acb_t x, const acb_t y) - int acb_overlaps(const acb_t x, const acb_t y) - int acb_contains_zero(const acb_t x) - int acb_contains_fmpq(const acb_t x, const fmpq_t y) - int acb_contains_fmpz(const acb_t x, const fmpz_t y) - int acb_contains(const acb_t x, const acb_t y) - int acb_contains_interior(const acb_t x, const acb_t y) - int acb_get_unique_fmpz(fmpz_t z, const acb_t x) - int acb_contains_int(const acb_t x) - void acb_union(acb_t z, const acb_t x, const acb_t y, long prec) - void acb_set_ui(acb_t z, ulong c) - void acb_set_si(acb_t z, long c) - void acb_set_fmpz(acb_t z, const fmpz_t c) - void acb_set_round_fmpz(acb_t z, const fmpz_t y, long prec) - void acb_set_fmpq(acb_t z, const fmpq_t c, long prec) - void acb_set_arb(acb_t z, const arb_t c) - void acb_set_round_arb(acb_t z, const arb_t x, long prec) - void acb_trim(acb_t z, const acb_t x) - void acb_add_error_arf(acb_t x, const arf_t err) - void acb_add_error_mag(acb_t x, const mag_t err) - void acb_get_mag(mag_t z, const acb_t x) - void acb_get_mag_lower(mag_t z, const acb_t x) - void acb_get_abs_ubound_arf(arf_t u, const acb_t z, long prec) - void acb_get_abs_lbound_arf(arf_t u, const acb_t z, long prec) - void acb_get_rad_ubound_arf(arf_t u, const acb_t z, long prec) - void acb_arg(arb_t r, const acb_t z, long prec) - void acb_add(acb_t z, const acb_t x, const acb_t y, long prec) - void acb_sub(acb_t z, const acb_t x, const acb_t y, long prec) - void acb_add_ui(acb_t z, const acb_t x, ulong c, long prec) - void acb_sub_ui(acb_t z, const acb_t x, ulong c, long prec) - void acb_add_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) - void acb_add_arb(acb_t z, const acb_t x, const arb_t y, long prec) - void acb_sub_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) - void acb_sub_arb(acb_t z, const acb_t x, const arb_t y, long prec) - void acb_neg(acb_t z, const acb_t x) - void acb_conj(acb_t z, const acb_t x) - void acb_abs(arb_t u, const acb_t z, long prec) - void acb_sgn(acb_t u, const acb_t z, long prec) - void acb_csgn(arb_t u, const acb_t z) - void acb_get_real(arb_t u, const acb_t z) - void acb_get_imag(arb_t u, const acb_t z) - - void acb_real_abs(acb_t res, const acb_t z, int analytic, long prec) - void acb_real_sgn(acb_t res, const acb_t z, int analytic, long prec) - void acb_real_heaviside(acb_t res, const acb_t z, int analytic, long prec) - void acb_real_floor(acb_t res, const acb_t z, int analytic, long prec) - void acb_real_ceil(acb_t res, const acb_t z, int analytic, long prec) - void acb_real_max(acb_t res, const acb_t x, const acb_t y, int analytic, long prec) - void acb_real_min(acb_t res, const acb_t x, const acb_t y, int analytic, long prec) - void acb_real_sqrtpos(acb_t res, const acb_t z, int analytic, long prec) - - void acb_sqrt_analytic(acb_t res, const acb_t z, int analytic, long prec) - void acb_rsqrt_analytic(acb_t res, const acb_t z, int analytic, long prec) - void acb_log_analytic(acb_t res, const acb_t z, int analytic, long prec) - void acb_pow_analytic(acb_t res, const acb_t z, const acb_t w, int analytic, long prec) - - void acb_mul_ui(acb_t z, const acb_t x, ulong y, long prec) - void acb_mul_si(acb_t z, const acb_t x, long y, long prec) - void acb_mul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) - void acb_mul_arb(acb_t z, const acb_t x, const arb_t y, long prec) - void acb_mul_onei(acb_t z, const acb_t x) - void acb_mul(acb_t z, const acb_t x, const acb_t y, long prec) - void acb_mul_2exp_si(acb_t z, const acb_t x, long e) - void acb_mul_2exp_fmpz(acb_t z, const acb_t x, const fmpz_t c) - void acb_addmul(acb_t z, const acb_t x, const acb_t y, long prec) - void acb_submul(acb_t z, const acb_t x, const acb_t y, long prec) - void acb_addmul_ui(acb_t z, const acb_t x, ulong y, long prec) - void acb_addmul_si(acb_t z, const acb_t x, long y, long prec) - void acb_submul_ui(acb_t z, const acb_t x, ulong y, long prec) - void acb_submul_si(acb_t z, const acb_t x, long y, long prec) - void acb_addmul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) - void acb_submul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) - void acb_addmul_arb(acb_t z, const acb_t x, const arb_t y, long prec) - void acb_submul_arb(acb_t z, const acb_t x, const arb_t y, long prec) - void acb_inv(acb_t z, const acb_t x, long prec) - void acb_div(acb_t z, const acb_t x, const acb_t y, long prec) - void acb_div_ui(acb_t z, const acb_t x, ulong c, long prec) - void acb_div_si(acb_t z, const acb_t x, long c, long prec) - void acb_div_arb(acb_t z, const acb_t x, const arb_t c, long prec) - void acb_div_fmpz(acb_t z, const acb_t x, const fmpz_t c, long prec) - void acb_cube(acb_t y, const acb_t x, long prec) - void acb_pow_fmpz(acb_t y, const acb_t b, const fmpz_t e, long prec) - void acb_pow_ui(acb_t y, const acb_t b, ulong e, long prec) - void acb_pow_si(acb_t y, const acb_t b, long e, long prec) - void acb_const_pi(acb_t x, long prec) - void acb_log(acb_t r, const acb_t z, long prec) - void acb_exp(acb_t r, const acb_t z, long prec) - void acb_exp_pi_i(acb_t r, const acb_t z, long prec) - void acb_sin(acb_t r, const acb_t z, long prec) - void acb_cos(acb_t r, const acb_t z, long prec) - void acb_sin_cos(acb_t s, acb_t c, const acb_t z, long prec) - void acb_tan(acb_t r, const acb_t z, long prec) - void acb_cot(acb_t r, const acb_t z, long prec) - void acb_sec(acb_t r, const acb_t z, long prec) - void acb_csc(acb_t r, const acb_t z, long prec) - void acb_sin_pi(acb_t r, const acb_t z, long prec) - void acb_cos_pi(acb_t r, const acb_t z, long prec) - void acb_sin_cos_pi(acb_t s, acb_t c, const acb_t z, long prec) - void acb_tan_pi(acb_t r, const acb_t z, long prec) - void acb_cot_pi(acb_t r, const acb_t z, long prec) - void acb_sinh(acb_t r, const acb_t z, long prec) - void acb_cosh(acb_t r, const acb_t z, long prec) - void acb_sinh_cosh(acb_t s, acb_t c, const acb_t z, long prec) - void acb_tanh(acb_t r, const acb_t z, long prec) - void acb_coth(acb_t r, const acb_t z, long prec) - void acb_sech(acb_t r, const acb_t z, long prec) - void acb_csch(acb_t r, const acb_t z, long prec) - void acb_sinc(acb_t r, const acb_t z, long prec) - void acb_sinc_pi(acb_t r, const acb_t z, long prec) - void acb_pow_arb(acb_t z, const acb_t x, const arb_t y, long prec) - void acb_pow(acb_t r, const acb_t x, const acb_t y, long prec) - void acb_sqrt(acb_t y, const acb_t x, long prec) - void acb_rsqrt(acb_t y, const acb_t x, long prec) - void acb_rising_ui_bs(acb_t y, const acb_t x, ulong n, long prec) - void acb_rising_ui_rs(acb_t y, const acb_t x, ulong n, ulong m, long prec) - void acb_rising_ui_rec(acb_t y, const acb_t x, ulong n, long prec) - void acb_rising_ui(acb_t z, const acb_t x, ulong n, long prec) - void acb_rising2_ui_bs(acb_t u, acb_t v, const acb_t x, ulong n, long prec) - void acb_rising2_ui_rs(acb_t u, acb_t v, const acb_t x, ulong n, ulong m, long prec) - void acb_rising2_ui(acb_t u, acb_t v, const acb_t x, ulong n, long prec) - void acb_rising_ui_get_mag(mag_t bound, const acb_t s, ulong n) - void acb_rising(acb_t y, const acb_t x, const acb_t n, long prec) - - void acb_gamma(acb_t y, const acb_t x, long prec) - void acb_rgamma(acb_t y, const acb_t x, long prec) - void acb_lgamma(acb_t y, const acb_t x, long prec) - void acb_digamma(acb_t y, const acb_t x, long prec) - void acb_zeta(acb_t z, const acb_t s, long prec) - void acb_hurwitz_zeta(acb_t z, const acb_t s, const acb_t a, long prec) - void acb_polylog(acb_t w, const acb_t s, const acb_t z, long prec) - void acb_polylog_si(acb_t w, long s, const acb_t z, long prec) - void acb_agm1(acb_t m, const acb_t z, long prec) - void acb_agm1_cpx(acb_ptr m, const acb_t z, long len, long prec) - void acb_agm(acb_t res, const acb_t a, const acb_t b, long prec) - void acb_expm1(acb_t r, const acb_t z, long prec) - void acb_log1p(acb_t r, const acb_t z, long prec) - void acb_asin(acb_t r, const acb_t z, long prec) - void acb_acos(acb_t r, const acb_t z, long prec) - void acb_atan(acb_t r, const acb_t z, long prec) - void acb_asinh(acb_t r, const acb_t z, long prec) - void acb_acosh(acb_t r, const acb_t z, long prec) - void acb_atanh(acb_t r, const acb_t z, long prec) - void acb_log_sin_pi(acb_t res, const acb_t z, long prec) - - void acb_polygamma(acb_t w, const acb_t s, const acb_t z, long prec) - void acb_log_barnes_g(acb_t w, const acb_t z, long prec) - void acb_barnes_g(acb_t w, const acb_t z, long prec) - - void acb_bernoulli_poly_ui(acb_t res, ulong n, const acb_t x, long prec) - - void acb_lambertw(acb_t z, const acb_t x, const fmpz_t k, int flags, long prec) - - long acb_rel_error_bits(const acb_t x) - long acb_rel_accuracy_bits(const acb_t x) - long acb_bits(const acb_t x) - - void acb_root_ui(acb_t z, const acb_t x, ulong k, long prec) - -cdef extern from "partitions.h": - void partitions_fmpz_fmpz(fmpz_t, const fmpz_t, int) - -cdef extern from "bernoulli.h": - void bernoulli_fmpq_ui(fmpq_t, ulong) - void bernoulli_cache_compute(long n) - - -cdef extern from "arb_poly.h": - ctypedef struct arb_poly_struct: - arb_ptr coeffs - long length - long alloc - - ctypedef arb_poly_struct arb_poly_t[1] - - void arb_poly_init(arb_poly_t poly) - void arb_poly_init2(arb_poly_t poly, long len) - void arb_poly_clear(arb_poly_t poly) - void arb_poly_fit_length(arb_poly_t poly, long len) - void _arb_poly_set_length(arb_poly_t poly, long len) - void _arb_poly_normalise(arb_poly_t poly) - void arb_poly_swap(arb_poly_t poly1, arb_poly_t poly2) - void arb_poly_set(arb_poly_t poly, const arb_poly_t src) - void arb_poly_set_round(arb_poly_t dest, const arb_poly_t src, long prec) - long arb_poly_length(const arb_poly_t poly) - long arb_poly_degree(const arb_poly_t poly) - void arb_poly_zero(arb_poly_t poly) - void arb_poly_one(arb_poly_t poly) - void arb_poly_set_coeff_si(arb_poly_t poly, long n, long x) - void arb_poly_set_coeff_arb(arb_poly_t poly, long n, const arb_t x) - void arb_poly_get_coeff_arb(arb_t x, const arb_poly_t poly, long n) - arb_ptr arb_poly_get_coeff_ptr(arb_poly_t poly, long n) - void _arb_poly_reverse(arb_ptr res, arb_srcptr poly, long len, long n) - void _arb_poly_shift_right(arb_ptr res, arb_srcptr poly, long len, long n) - void arb_poly_shift_right(arb_poly_t res, const arb_poly_t poly, long n) - void _arb_poly_shift_left(arb_ptr res, arb_srcptr poly, long len, long n) - void arb_poly_shift_left(arb_poly_t res, const arb_poly_t poly, long n) - void arb_poly_truncate(arb_poly_t poly, long newlen) - void arb_poly_set_fmpz_poly(arb_poly_t poly, const fmpz_poly_t src, long prec) - void arb_poly_set_fmpq_poly(arb_poly_t poly, const fmpq_poly_t src, long prec) - void arb_poly_set_arb(arb_poly_t poly, const arb_t c) - void arb_poly_set_si(arb_poly_t poly, long c) - int arb_poly_contains(const arb_poly_t poly1, const arb_poly_t poly2) - int arb_poly_contains_fmpz_poly(const arb_poly_t poly1, const fmpz_poly_t poly2) - int arb_poly_contains_fmpq_poly(const arb_poly_t poly1, const fmpq_poly_t poly2) - int arb_poly_equal(const arb_poly_t A, const arb_poly_t B) - int _arb_poly_overlaps(arb_srcptr poly1, long len1, arb_srcptr poly2, long len2) - int arb_poly_overlaps(const arb_poly_t poly1, const arb_poly_t poly2) - void arb_poly_printd(const arb_poly_t poly, long digits) - void arb_poly_randtest(arb_poly_t poly, flint_rand_t state, long len, long prec, long mag_bits) - void _arb_poly_add(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) - void arb_poly_add(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) - void _arb_poly_sub(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) - void arb_poly_sub(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) - void arb_poly_neg(arb_poly_t res, const arb_poly_t poly) - void arb_poly_scalar_mul_2exp_si(arb_poly_t res, const arb_poly_t poly, long c) - void _arb_poly_mullow(arb_ptr C, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long n, long prec) - void arb_poly_mullow(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long len, long prec) - void _arb_poly_mul(arb_ptr C, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) - void arb_poly_mul(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) - void _arb_poly_inv_series(arb_ptr Qinv, arb_srcptr Q, long Qlen, long len, long prec) - void arb_poly_inv_series(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) - void _arb_poly_div_series(arb_ptr Q, arb_srcptr A, long Alen, arb_srcptr B, long Blen, long n, long prec) - void arb_poly_div_series(arb_poly_t Q, const arb_poly_t A, const arb_poly_t B, long n, long prec) - void _arb_poly_div(arb_ptr Q, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) - void _arb_poly_divrem(arb_ptr Q, arb_ptr R, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) - void _arb_poly_rem(arb_ptr R, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) - int arb_poly_divrem(arb_poly_t Q, arb_poly_t R, const arb_poly_t A, const arb_poly_t B, long prec) - void _arb_poly_div_root(arb_ptr Q, arb_t R, arb_srcptr A, long len, const arb_t c, long prec) - void _arb_poly_product_roots(arb_ptr poly, arb_srcptr xs, long n, long prec) - void arb_poly_product_roots(arb_poly_t poly, arb_srcptr xs, long n, long prec) - arb_ptr * _arb_poly_tree_alloc(long len) - void _arb_poly_tree_free(arb_ptr * tree, long len) - void _arb_poly_tree_build(arb_ptr * tree, arb_srcptr roots, long len, long prec) - void _arb_poly_compose(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) - void arb_poly_compose(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) - void _arb_poly_compose_horner(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) - void arb_poly_compose_horner(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) - void _arb_poly_compose_divconquer(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) - void arb_poly_compose_divconquer(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) - void _arb_poly_compose_series_horner(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long n, long prec) - void arb_poly_compose_series_horner(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long n, long prec) - void _arb_poly_compose_series(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long n, long prec) - void arb_poly_compose_series(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long n, long prec) - void _arb_poly_revert_series_lagrange(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) - void arb_poly_revert_series_lagrange(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) - void _arb_poly_revert_series_newton(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) - void arb_poly_revert_series_newton(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) - void _arb_poly_revert_series_lagrange_fast(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) - void arb_poly_revert_series_lagrange_fast(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) - void _arb_poly_revert_series(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) - void arb_poly_revert_series(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) - - void _arb_poly_evaluate_horner(arb_t res, arb_srcptr f, long len, const arb_t a, long prec) - void arb_poly_evaluate_horner(arb_t res, const arb_poly_t f, const arb_t a, long prec) - void _arb_poly_evaluate_rectangular(arb_t y, arb_srcptr poly, long len, const arb_t x, long prec) - void arb_poly_evaluate_rectangular(arb_t res, const arb_poly_t f, const arb_t a, long prec) - void _arb_poly_evaluate(arb_t res, arb_srcptr f, long len, const arb_t a, long prec) - void arb_poly_evaluate(arb_t res, const arb_poly_t f, const arb_t a, long prec) - void _arb_poly_evaluate2_horner(arb_t y, arb_t z, arb_srcptr f, long len, const arb_t x, long prec) - void arb_poly_evaluate2_horner(arb_t y, arb_t z, const arb_poly_t f, const arb_t x, long prec) - void _arb_poly_evaluate2_rectangular(arb_t y, arb_t z, arb_srcptr f, long len, const arb_t x, long prec) - void arb_poly_evaluate2_rectangular(arb_t y, arb_t z, const arb_poly_t f, const arb_t x, long prec) - void _arb_poly_evaluate2(arb_t y, arb_t z, arb_srcptr f, long len, const arb_t x, long prec) - void arb_poly_evaluate2(arb_t y, arb_t z, const arb_poly_t f, const arb_t x, long prec) - - void _arb_poly_evaluate_vec_iter(arb_ptr ys, arb_srcptr poly, long plen, arb_srcptr xs, long n, long prec) - void arb_poly_evaluate_vec_iter(arb_ptr ys, const arb_poly_t poly, arb_srcptr xs, long n, long prec) - void _arb_poly_evaluate_vec_fast_precomp(arb_ptr vs, arb_srcptr poly, long plen, arb_ptr * tree, long len, long prec) - void _arb_poly_evaluate_vec_fast(arb_ptr ys, arb_srcptr poly, long plen, arb_srcptr xs, long n, long prec) - void arb_poly_evaluate_vec_fast(arb_ptr ys, const arb_poly_t poly, arb_srcptr xs, long n, long prec) - void _arb_poly_interpolate_newton(arb_ptr poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) - void arb_poly_interpolate_newton(arb_poly_t poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) - void _arb_poly_interpolate_barycentric(arb_ptr poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) - void arb_poly_interpolate_barycentric(arb_poly_t poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) - void _arb_poly_interpolation_weights(arb_ptr w, arb_ptr * tree, long len, long prec) - void _arb_poly_interpolate_fast_precomp(arb_ptr poly, arb_srcptr ys, arb_ptr * tree, arb_srcptr weights, long len, long prec) - void _arb_poly_interpolate_fast(arb_ptr poly, arb_srcptr xs, arb_srcptr ys, long len, long prec) - void arb_poly_interpolate_fast(arb_poly_t poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) - - void _arb_poly_derivative(arb_ptr res, arb_srcptr poly, long len, long prec) - void arb_poly_derivative(arb_poly_t res, const arb_poly_t poly, long prec) - void _arb_poly_integral(arb_ptr res, arb_srcptr poly, long len, long prec) - void arb_poly_integral(arb_poly_t res, const arb_poly_t poly, long prec) - - void arb_poly_borel_transform(arb_poly_t res, const arb_poly_t poly, long prec) - void _arb_poly_borel_transform(arb_ptr res, arb_srcptr poly, long len, long prec) - void arb_poly_inv_borel_transform(arb_poly_t res, const arb_poly_t poly, long prec) - void _arb_poly_inv_borel_transform(arb_ptr res, arb_srcptr poly, long len, long prec) - void _arb_poly_binomial_transform_basecase(arb_ptr b, arb_srcptr a, long alen, long len, long prec) - void arb_poly_binomial_transform_basecase(arb_poly_t b, const arb_poly_t a, long len, long prec) - void _arb_poly_binomial_transform_convolution(arb_ptr b, arb_srcptr a, long alen, long len, long prec) - void arb_poly_binomial_transform_convolution(arb_poly_t b, const arb_poly_t a, long len, long prec) - void _arb_poly_binomial_transform(arb_ptr b, arb_srcptr a, long alen, long len, long prec) - void arb_poly_binomial_transform(arb_poly_t b, const arb_poly_t a, long len, long prec) - - void _arb_poly_pow_ui_trunc_binexp(arb_ptr res, arb_srcptr f, long flen, ulong exp, long len, long prec) - void arb_poly_pow_ui_trunc_binexp(arb_poly_t res, const arb_poly_t poly, ulong exp, long len, long prec) - void _arb_poly_pow_ui(arb_ptr res, arb_srcptr f, long flen, ulong exp, long prec) - void arb_poly_pow_ui(arb_poly_t res, const arb_poly_t poly, ulong exp, long prec) - void _arb_poly_pow_series(arb_ptr h, arb_srcptr f, long flen, arb_srcptr g, long glen, long len, long prec) - void arb_poly_pow_series(arb_poly_t h, const arb_poly_t f, const arb_poly_t g, long len, long prec) - void _arb_poly_pow_arb_series(arb_ptr h, arb_srcptr f, long flen, const arb_t g, long len, long prec) - void arb_poly_pow_arb_series(arb_poly_t h, const arb_poly_t f, const arb_t g, long len, long prec) - void _arb_poly_rsqrt_series(arb_ptr g, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_rsqrt_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - void _arb_poly_sqrt_series(arb_ptr g, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_sqrt_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - void _arb_poly_log_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) - void arb_poly_log_series(arb_poly_t res, const arb_poly_t f, long n, long prec) - void _arb_poly_atan_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) - void arb_poly_atan_series(arb_poly_t res, const arb_poly_t f, long n, long prec) - void _arb_poly_asin_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) - void arb_poly_asin_series(arb_poly_t res, const arb_poly_t f, long n, long prec) - void _arb_poly_acos_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) - void arb_poly_acos_series(arb_poly_t res, const arb_poly_t f, long n, long prec) - void _arb_poly_exp_series_basecase(arb_ptr f, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_exp_series_basecase(arb_poly_t f, const arb_poly_t h, long n, long prec) - void _arb_poly_exp_series(arb_ptr f, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_exp_series(arb_poly_t f, const arb_poly_t h, long n, long prec) - void _arb_poly_sin_cos_series_basecase(arb_ptr s, arb_ptr c, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_sin_cos_series_basecase(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) - void _arb_poly_sin_cos_series_tangent(arb_ptr s, arb_ptr c, const arb_srcptr h, long hlen, long len, long prec) - void arb_poly_sin_cos_series_tangent(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) - void _arb_poly_sin_cos_series(arb_ptr s, arb_ptr c, const arb_srcptr h, long hlen, long len, long prec) - void arb_poly_sin_cos_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) - void _arb_poly_sin_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_sin_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - void _arb_poly_cos_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_cos_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - void _arb_poly_tan_series(arb_ptr g, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_tan_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - void _arb_poly_compose_series_brent_kung(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long n, long prec) - void arb_poly_compose_series_brent_kung(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long n, long prec) - void _arb_poly_evaluate_acb_horner(acb_t res, arb_srcptr f, long len, const acb_t x, long prec) - void arb_poly_evaluate_acb_horner(acb_t res, const arb_poly_t f, const acb_t a, long prec) - void _arb_poly_evaluate_acb_rectangular(acb_t y, arb_srcptr poly, long len, const acb_t x, long prec) - void arb_poly_evaluate_acb_rectangular(acb_t res, const arb_poly_t f, const acb_t a, long prec) - void _arb_poly_evaluate_acb(acb_t res, arb_srcptr f, long len, const acb_t x, long prec) - void arb_poly_evaluate_acb(acb_t res, const arb_poly_t f, const acb_t a, long prec) - void _arb_poly_evaluate2_acb_horner(acb_t y, acb_t z, arb_srcptr f, long len, const acb_t x, long prec) - void arb_poly_evaluate2_acb_horner(acb_t y, acb_t z, const arb_poly_t f, const acb_t x, long prec) - void _arb_poly_evaluate2_acb_rectangular(acb_t y, acb_t z, arb_srcptr f, long len, const acb_t x, long prec) - void arb_poly_evaluate2_acb_rectangular(acb_t y, acb_t z, const arb_poly_t f, const acb_t x, long prec) - void _arb_poly_evaluate2_acb(acb_t y, acb_t z, arb_srcptr f, long len, const acb_t x, long prec) - void arb_poly_evaluate2_acb(acb_t y, acb_t z, const arb_poly_t f, const acb_t x, long prec) - void _arb_poly_gamma_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_gamma_series(arb_poly_t res, const arb_poly_t f, long n, long prec) - void _arb_poly_rgamma_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_rgamma_series(arb_poly_t res, const arb_poly_t f, long n, long prec) - void _arb_poly_lgamma_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_lgamma_series(arb_poly_t res, const arb_poly_t f, long n, long prec) - void _arb_poly_rising_ui_series(arb_ptr res, arb_srcptr f, long flen, ulong r, long trunc, long prec) - void arb_poly_rising_ui_series(arb_poly_t res, const arb_poly_t f, ulong r, long trunc, long prec) - void _arb_poly_zeta_series(arb_ptr res, arb_srcptr h, long hlen, const arb_t a, int deflate, long len, long prec) - void arb_poly_zeta_series(arb_poly_t res, const arb_poly_t f, const arb_t a, int deflate, long n, long prec) - void _arb_poly_riemann_siegel_theta_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_riemann_siegel_theta_series(arb_poly_t res, const arb_poly_t h, long n, long prec) - void _arb_poly_riemann_siegel_z_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) - void arb_poly_riemann_siegel_z_series(arb_poly_t res, const arb_poly_t h, long n, long prec) - - void arb_poly_swinnerton_dyer_ui(arb_poly_t poly, ulong n, long prec) - int arb_poly_get_unique_fmpz_poly(fmpz_poly_t res, const arb_poly_t src) - - void _arb_poly_sin_cos_pi_series(arb_ptr s, arb_ptr c, const arb_srcptr h, long hlen, long len, long prec) - void arb_poly_sin_cos_pi_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) - void _arb_poly_sin_pi_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_sin_pi_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - void _arb_poly_cos_pi_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_cos_pi_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - void _arb_poly_cot_pi_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) - void arb_poly_cot_pi_series(arb_poly_t g, const arb_poly_t h, long n, long prec) - - void arb_poly_lambertw_series(arb_poly_t res, const arb_poly_t z, int flags, long len, long prec) - -cdef extern from "arb_mat.h": - ctypedef struct arb_mat_struct: - arb_ptr entries - long r - long c - arb_ptr * rows - - ctypedef arb_mat_struct arb_mat_t[1] - - arb_struct * arb_mat_entry(arb_mat_t mat, long i, long j) - - long arb_mat_nrows(const arb_mat_t x) - long arb_mat_ncols(const arb_mat_t x) - - void arb_mat_init(arb_mat_t mat, long r, long c) - void arb_mat_clear(arb_mat_t mat) - - void arb_mat_set(arb_mat_t dest, const arb_mat_t src) - void arb_mat_set_fmpz_mat(arb_mat_t dest, const fmpz_mat_t src) - void arb_mat_set_fmpq_mat(arb_mat_t dest, const fmpq_mat_t src, long prec) - void arb_mat_printd(const arb_mat_t mat, long digits) - int arb_mat_equal(const arb_mat_t mat1, const arb_mat_t mat2) - int arb_mat_overlaps(const arb_mat_t mat1, const arb_mat_t mat2) - int arb_mat_contains(const arb_mat_t mat1, const arb_mat_t mat2) - int arb_mat_contains_fmpq_mat(const arb_mat_t mat1, const fmpq_mat_t mat2) - int arb_mat_contains_fmpz_mat(const arb_mat_t mat1, const fmpz_mat_t mat2) - - void arb_mat_zero(arb_mat_t mat) - void arb_mat_one(arb_mat_t mat) - - void arb_mat_bound_inf_norm(mag_t b, const arb_mat_t A) - - void arb_mat_neg(arb_mat_t dest, const arb_mat_t src) - void arb_mat_add(arb_mat_t res, const arb_mat_t mat1, const arb_mat_t mat2, long prec) - void arb_mat_sub(arb_mat_t res, const arb_mat_t mat1, const arb_mat_t mat2, long prec) - void arb_mat_mul(arb_mat_t res, const arb_mat_t mat1, const arb_mat_t mat2, long prec) - void arb_mat_pow_ui(arb_mat_t B, const arb_mat_t A, ulong exp, long prec) - - void arb_mat_scalar_mul_2exp_si(arb_mat_t B, const arb_mat_t A, long c) - void arb_mat_scalar_addmul_si(arb_mat_t B, const arb_mat_t A, long c, long prec) - void arb_mat_scalar_mul_si(arb_mat_t B, const arb_mat_t A, long c, long prec) - void arb_mat_scalar_div_si(arb_mat_t B, const arb_mat_t A, long c, long prec) - void arb_mat_scalar_addmul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec) - void arb_mat_scalar_mul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec) - void arb_mat_scalar_div_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec) - void arb_mat_scalar_addmul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec) - void arb_mat_scalar_mul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec) - void arb_mat_scalar_div_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec) - - int arb_mat_lu(long * P, arb_mat_t LU, const arb_mat_t A, long prec) - void arb_mat_solve_lu_precomp(arb_mat_t X, const long * perm, const arb_mat_t A, const arb_mat_t B, long prec) - int arb_mat_solve(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) - int arb_mat_solve_lu(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) - int arb_mat_solve_precond(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) - int arb_mat_inv(arb_mat_t X, const arb_mat_t A, long prec) - void arb_mat_det(arb_t det, const arb_mat_t A, long prec) - - void arb_mat_exp(arb_mat_t B, const arb_mat_t A, long prec) - - void _arb_mat_charpoly(arb_ptr cp, const arb_mat_t mat, long prec) - void arb_mat_charpoly(arb_poly_t cp, const arb_mat_t mat, long prec) - - void arb_mat_transpose(arb_mat_t B, const arb_mat_t A) - - void arb_mat_trace(arb_t trace, const arb_mat_t mat, long prec) - void arb_mat_ones(arb_mat_t mat) - void arb_mat_hilbert(arb_mat_t mat, long prec) - void arb_mat_pascal(arb_mat_t mat, int triangular, long prec) - void arb_mat_stirling(arb_mat_t mat, int kind, long prec) - void arb_mat_dct(arb_mat_t mat, int type, long prec) - - void arb_mat_get_mid(arb_mat_t B, const arb_mat_t A) - - int arb_mat_eq(const arb_mat_t mat1, const arb_mat_t mat2) - int arb_mat_ne(const arb_mat_t mat1, const arb_mat_t mat2) - int arb_mat_equal(const arb_mat_t mat1, const arb_mat_t mat2) - - void arb_mat_frobenius_norm(arb_t res, const arb_mat_t A, long prec) - - int arb_mat_approx_solve(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) - -cdef extern from "acb_poly.h": - ctypedef struct acb_poly_struct: - acb_ptr coeffs - long length - long alloc - - ctypedef acb_poly_struct acb_poly_t[1] - - void acb_poly_init(acb_poly_t poly) - void acb_poly_init2(acb_poly_t poly, long len) - void acb_poly_clear(acb_poly_t poly) - void acb_poly_fit_length(acb_poly_t poly, long len) - void _acb_poly_set_length(acb_poly_t poly, long len) - void _acb_poly_normalise(acb_poly_t poly) - void acb_poly_swap(acb_poly_t poly1, acb_poly_t poly2) - long acb_poly_length(const acb_poly_t poly) - long acb_poly_degree(const acb_poly_t poly) - void acb_poly_zero(acb_poly_t poly) - void acb_poly_one(acb_poly_t poly) - void acb_poly_set_coeff_si(acb_poly_t poly, long n, long x) - void acb_poly_set_coeff_acb(acb_poly_t poly, long n, const acb_t x) - void acb_poly_get_coeff_acb(acb_t x, const acb_poly_t poly, long n) - acb_ptr acb_poly_get_coeff_ptr(arb_poly_t poly, long n) - void _acb_poly_shift_right(acb_ptr res, acb_srcptr poly, long len, long n) - void acb_poly_shift_right(acb_poly_t res, const acb_poly_t poly, long n) - void _acb_poly_shift_left(acb_ptr res, acb_srcptr poly, long len, long n) - void acb_poly_shift_left(acb_poly_t res, const acb_poly_t poly, long n) - void acb_poly_truncate(acb_poly_t poly, long newlen) - void acb_poly_printd(const acb_poly_t poly, long digits) - void _acb_poly_evaluate_horner(acb_t res, acb_srcptr f, long len, const acb_t a, long prec) - void acb_poly_evaluate_horner(acb_t res, const acb_poly_t f, const acb_t a, long prec) - void _acb_poly_evaluate_rectangular(acb_t y, acb_srcptr poly, long len, const acb_t x, long prec) - void acb_poly_evaluate_rectangular(acb_t res, const acb_poly_t f, const acb_t a, long prec) - void _acb_poly_evaluate(acb_t res, acb_srcptr f, long len, const acb_t a, long prec) - void acb_poly_evaluate(acb_t res, const acb_poly_t f, const acb_t a, long prec) - void _acb_poly_evaluate2_horner(acb_t y, acb_t z, acb_srcptr f, long len, const acb_t x, long prec) - void acb_poly_evaluate2_horner(acb_t y, acb_t z, const acb_poly_t f, const acb_t x, long prec) - void _acb_poly_evaluate2_rectangular(acb_t y, acb_t z, acb_srcptr f, long len, const acb_t x, long prec) - void acb_poly_evaluate2_rectangular(acb_t y, acb_t z, const acb_poly_t f, const acb_t x, long prec) - void _acb_poly_evaluate2(acb_t y, acb_t z, acb_srcptr f, long len, const acb_t x, long prec) - void acb_poly_evaluate2(acb_t y, acb_t z, const acb_poly_t f, const acb_t x, long prec) - void _acb_poly_derivative(acb_ptr res, acb_srcptr poly, long len, long prec) - void acb_poly_derivative(acb_poly_t res, const acb_poly_t poly, long prec) - void _acb_poly_integral(acb_ptr res, acb_srcptr poly, long len, long prec) - void acb_poly_integral(acb_poly_t res, const acb_poly_t poly, long prec) - void acb_poly_set(acb_poly_t dest, const acb_poly_t src) - void acb_poly_set_round(acb_poly_t dest, const acb_poly_t src, long prec) - void acb_poly_set_arb_poly(acb_poly_t poly, const arb_poly_t re) - void acb_poly_set2_arb_poly(acb_poly_t poly, const arb_poly_t re, const arb_poly_t im) - void acb_poly_set_fmpq_poly(acb_poly_t poly, const fmpq_poly_t re, long prec) - void acb_poly_set2_fmpq_poly(acb_poly_t poly, const fmpq_poly_t re, const fmpq_poly_t im, long prec) - void acb_poly_set_fmpz_poly(acb_poly_t poly, const fmpz_poly_t src, long prec) - void acb_poly_set_acb(acb_poly_t poly, const acb_t c) - void acb_poly_set_si(acb_poly_t poly, long c) - void acb_poly_randtest(acb_poly_t poly, flint_rand_t state, long len, long prec, long mag_bits) - int acb_poly_equal(const acb_poly_t A, const acb_poly_t B) - int acb_poly_contains_fmpz_poly(const acb_poly_t poly1, const fmpz_poly_t poly2) - int acb_poly_contains_fmpq_poly(const acb_poly_t poly1, const fmpq_poly_t poly2) - int _acb_poly_overlaps(acb_srcptr poly1, long len1, acb_srcptr poly2, long len2) - int acb_poly_overlaps(const acb_poly_t poly1, const acb_poly_t poly2) - int acb_poly_contains(const acb_poly_t poly1, const acb_poly_t poly2) - void _acb_poly_add(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) - void acb_poly_add(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) - void _acb_poly_sub(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) - void acb_poly_sub(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) - void acb_poly_neg(acb_poly_t res, const acb_poly_t poly) - void acb_poly_scalar_mul_2exp_si(acb_poly_t res, const acb_poly_t poly, long c) - void acb_poly_mullow_classical(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) - void _acb_poly_mullow_classical(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) - void _acb_poly_mullow_transpose(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) - void acb_poly_mullow_transpose(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) - void _acb_poly_mullow_transpose_gauss(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) - void acb_poly_mullow_transpose_gauss(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) - void _acb_poly_mullow(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) - void acb_poly_mullow(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) - void _acb_poly_mul(acb_ptr C, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) - void acb_poly_mul(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) - void _acb_poly_inv_series(acb_ptr Qinv, acb_srcptr Q, long Qlen, long len, long prec) - void acb_poly_inv_series(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) - void _acb_poly_div_series(acb_ptr Q, acb_srcptr A, long Alen, acb_srcptr B, long Blen, long n, long prec) - void acb_poly_div_series(acb_poly_t Q, const acb_poly_t A, const acb_poly_t B, long n, long prec) - void _acb_poly_reverse(acb_ptr res, acb_srcptr poly, long len, long n) - void _acb_poly_div(acb_ptr Q, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) - void _acb_poly_divrem(acb_ptr Q, acb_ptr R, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) - void _acb_poly_rem(acb_ptr R, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) - int acb_poly_divrem(acb_poly_t Q, acb_poly_t R, const acb_poly_t A, const acb_poly_t B, long prec) - void _acb_poly_div_root(acb_ptr Q, acb_t R, acb_srcptr A, long len, const acb_t c, long prec) - void _acb_poly_compose(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) - void acb_poly_compose(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) - void _acb_poly_compose_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) - void acb_poly_compose_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) - void _acb_poly_compose_divconquer(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) - void acb_poly_compose_divconquer(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) - void _acb_poly_compose_series_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) - void acb_poly_compose_series_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) - void _acb_poly_compose_series_brent_kung(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) - void acb_poly_compose_series_brent_kung(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) - void _acb_poly_compose_series(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) - void acb_poly_compose_series(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) - void _acb_poly_revert_series_lagrange(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) - void acb_poly_revert_series_lagrange(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) - void _acb_poly_revert_series_newton(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) - void acb_poly_revert_series_newton(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) - void _acb_poly_revert_series_lagrange_fast(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) - void acb_poly_revert_series_lagrange_fast(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) - void _acb_poly_revert_series(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) - void acb_poly_revert_series(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) - void _acb_poly_evaluate_vec_fast_precomp(acb_ptr vs, acb_srcptr poly, long plen, acb_ptr * tree, long len, long prec) - void _acb_poly_evaluate_vec_fast(acb_ptr ys, acb_srcptr poly, long plen, acb_srcptr xs, long n, long prec) - void acb_poly_evaluate_vec_fast(acb_ptr ys, const acb_poly_t poly, acb_srcptr xs, long n, long prec) - void _acb_poly_evaluate_vec_iter(acb_ptr ys, acb_srcptr poly, long plen, acb_srcptr xs, long n, long prec) - void acb_poly_evaluate_vec_iter(acb_ptr ys, const acb_poly_t poly, acb_srcptr xs, long n, long prec) - void _acb_poly_interpolate_barycentric(acb_ptr poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) - void acb_poly_interpolate_barycentric(acb_poly_t poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) - void _acb_poly_interpolation_weights(acb_ptr w, acb_ptr * tree, long len, long prec) - void _acb_poly_interpolate_fast_precomp(acb_ptr poly, acb_srcptr ys, acb_ptr * tree, acb_srcptr weights, long len, long prec) - void _acb_poly_interpolate_fast(acb_ptr poly, acb_srcptr xs, acb_srcptr ys, long len, long prec) - void acb_poly_interpolate_fast(acb_poly_t poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) - void _acb_poly_interpolate_newton(acb_ptr poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) - void acb_poly_interpolate_newton(acb_poly_t poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) - void _acb_poly_product_roots(acb_ptr poly, acb_srcptr xs, long n, long prec) - void acb_poly_product_roots(acb_poly_t poly, acb_srcptr xs, long n, long prec) - acb_ptr * _acb_poly_tree_alloc(long len) - void _acb_poly_tree_free(acb_ptr * tree, long len) - void _acb_poly_tree_build(acb_ptr * tree, acb_srcptr roots, long len, long prec) - void _acb_poly_root_inclusion(acb_t r, const acb_t m, acb_srcptr poly, acb_srcptr polyder, long len, long prec) - long _acb_poly_validate_roots(acb_ptr roots, acb_srcptr poly, long len, long prec) - void _acb_poly_refine_roots_durand_kerner(acb_ptr roots, acb_srcptr poly, long len, long prec) - long _acb_poly_find_roots(acb_ptr roots, acb_srcptr poly, acb_srcptr initial, long len, long maxiter, long prec) - long acb_poly_find_roots(acb_ptr roots, const acb_poly_t poly, acb_srcptr initial, long maxiter, long prec) - void _acb_poly_pow_ui_trunc_binexp(acb_ptr res, acb_srcptr f, long flen, ulong exp, long len, long prec) - void acb_poly_pow_ui_trunc_binexp(acb_poly_t res, const acb_poly_t poly, ulong exp, long len, long prec) - void _acb_poly_pow_ui(acb_ptr res, acb_srcptr f, long flen, ulong exp, long prec) - void acb_poly_pow_ui(acb_poly_t res, const acb_poly_t poly, ulong exp, long prec) - void _acb_poly_rsqrt_series(acb_ptr g, acb_srcptr h, long hlen, long len, long prec) - void acb_poly_rsqrt_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - void _acb_poly_sqrt_series(acb_ptr g, acb_srcptr h, long hlen, long len, long prec) - void acb_poly_sqrt_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - void _acb_poly_log_series(acb_ptr res, acb_srcptr f, long flen, long n, long prec) - void acb_poly_log_series(acb_poly_t res, const acb_poly_t f, long n, long prec) - void _acb_poly_atan_series(acb_ptr res, acb_srcptr f, long flen, long n, long prec) - void acb_poly_atan_series(acb_poly_t res, const acb_poly_t f, long n, long prec) - void _acb_poly_exp_series_basecase(acb_ptr f, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_exp_series_basecase(acb_poly_t f, const acb_poly_t h, long n, long prec) - void _acb_poly_exp_series(acb_ptr f, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_exp_series(acb_poly_t f, const acb_poly_t h, long n, long prec) - void _acb_poly_sin_cos_series_basecase(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_sin_cos_series_basecase(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) - void _acb_poly_sin_cos_series_tangent(acb_ptr s, acb_ptr c, const acb_srcptr h, long hlen, long len, long prec) - void acb_poly_sin_cos_series_tangent(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) - void _acb_poly_sin_cos_series(acb_ptr s, acb_ptr c, const acb_srcptr h, long hlen, long len, long prec) - void acb_poly_sin_cos_series(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) - void _acb_poly_sin_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_sin_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - void _acb_poly_cos_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_cos_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - void _acb_poly_tan_series(acb_ptr g, acb_srcptr h, long hlen, long len, long prec) - void acb_poly_tan_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - void _acb_poly_gamma_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) - void acb_poly_gamma_series(acb_poly_t res, const acb_poly_t f, long n, long prec) - void _acb_poly_rgamma_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) - void acb_poly_rgamma_series(acb_poly_t res, const acb_poly_t f, long n, long prec) - void _acb_poly_lgamma_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) - void acb_poly_lgamma_series(acb_poly_t res, const acb_poly_t f, long n, long prec) - void _acb_poly_rising_ui_series(acb_ptr res, acb_srcptr f, long flen, ulong r, long trunc, long prec) - void acb_poly_rising_ui_series(acb_poly_t res, const acb_poly_t f, ulong r, long trunc, long prec) - void _acb_poly_zeta_series(acb_ptr res, acb_srcptr h, long hlen, const acb_t a, int deflate, long len, long prec) - void acb_poly_zeta_series(acb_poly_t res, const acb_poly_t f, const acb_t a, int deflate, long n, long prec) - void _acb_poly_polylog_cpx_zeta(acb_ptr w, const acb_t s, const acb_t z, long len, long prec) - void _acb_poly_polylog_cpx_small(acb_ptr w, const acb_t s, const acb_t z, long len, long prec) - void _acb_poly_polylog_cpx(acb_ptr w, const acb_t s, const acb_t z, long len, long prec) - void _acb_poly_polylog_series(acb_ptr res, acb_srcptr s, long slen, const acb_t z, long len, long prec) - void acb_poly_polylog_series(acb_poly_t res, const acb_poly_t s, const acb_t z, long n, long prec) - - void _acb_poly_pow_series(acb_ptr h, acb_srcptr f, long flen, acb_srcptr g, long glen, long len, long prec) - void acb_poly_pow_series(acb_poly_t h, const acb_poly_t f, const acb_poly_t g, long len, long prec) - void _acb_poly_pow_acb_series(acb_ptr h, acb_srcptr f, long flen, const acb_t g, long len, long prec) - void acb_poly_pow_acb_series(acb_poly_t h, const acb_poly_t f, const acb_t g, long len, long prec) - - void _acb_poly_agm1_series(acb_ptr res, acb_srcptr z, long zlen, long len, long prec) - void acb_poly_agm1_series(acb_poly_t res, const acb_poly_t z, long n, long prec) - - void _acb_poly_elliptic_k_series(acb_ptr res, acb_srcptr z, long zlen, long len, long prec) - void acb_poly_elliptic_k_series(acb_poly_t res, const acb_poly_t z, long n, long prec) - void _acb_poly_elliptic_p_series(acb_ptr res, acb_srcptr z, long zlen, const acb_t tau, long len, long prec) - void acb_poly_elliptic_p_series(acb_poly_t res, const acb_poly_t z, const acb_t tau, long n, long prec) - - void _acb_poly_erf_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) - void acb_poly_erf_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - int acb_poly_get_unique_fmpz_poly(fmpz_poly_t res, const acb_poly_t src) - - void _acb_poly_sin_cos_pi_series(acb_ptr s, acb_ptr c, const acb_srcptr h, long hlen, long len, long prec) - void acb_poly_sin_cos_pi_series(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) - void _acb_poly_sin_pi_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_sin_pi_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - void _acb_poly_cos_pi_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_cos_pi_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - - void _acb_poly_cot_pi_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) - void acb_poly_cot_pi_series(acb_poly_t g, const acb_poly_t h, long n, long prec) - - void acb_poly_root_bound_fujiwara(mag_t bound, acb_poly_t poly) - - void acb_poly_lambertw_series(acb_poly_t res, const acb_poly_t z, const fmpz_t k, int flags, long len, long prec) - -cdef extern from "acb_mat.h": - ctypedef struct acb_mat_struct: - acb_ptr entries - long r - long c - acb_ptr * rows - - ctypedef acb_mat_struct acb_mat_t[1] - - acb_struct * acb_mat_entry(acb_mat_t mat, long i, long j) - - long acb_mat_nrows(const acb_mat_t x) - long acb_mat_ncols(const acb_mat_t x) - - void acb_mat_init(acb_mat_t mat, long r, long c) - void acb_mat_clear(acb_mat_t mat) - - void acb_mat_set(acb_mat_t dest, const acb_mat_t src) - void acb_mat_set_fmpz_mat(acb_mat_t dest, const fmpz_mat_t src) - void acb_mat_set_fmpq_mat(acb_mat_t dest, const fmpq_mat_t src, long prec) - void acb_mat_printd(const acb_mat_t mat, long digits) - int acb_mat_equal(const acb_mat_t mat1, const acb_mat_t mat2) - int acb_mat_overlaps(const acb_mat_t mat1, const acb_mat_t mat2) - int acb_mat_contains(const acb_mat_t mat1, const acb_mat_t mat2) - int acb_mat_contains_fmpq_mat(const acb_mat_t mat1, const fmpq_mat_t mat2) - int acb_mat_contains_fmpz_mat(const acb_mat_t mat1, const fmpz_mat_t mat2) - - void acb_mat_zero(acb_mat_t mat) - void acb_mat_one(acb_mat_t mat) - - void acb_mat_bound_inf_norm(mag_t b, const acb_mat_t A) - - void acb_mat_neg(acb_mat_t dest, const acb_mat_t src) - void acb_mat_add(acb_mat_t res, const acb_mat_t mat1, const acb_mat_t mat2, long prec) - void acb_mat_sub(acb_mat_t res, const acb_mat_t mat1, const acb_mat_t mat2, long prec) - void acb_mat_mul(acb_mat_t res, const acb_mat_t mat1, const acb_mat_t mat2, long prec) - void acb_mat_pow_ui(acb_mat_t B, const acb_mat_t A, ulong exp, long prec) - - void acb_mat_scalar_mul_2exp_si(acb_mat_t B, const acb_mat_t A, long c) - void acb_mat_scalar_addmul_si(acb_mat_t B, const acb_mat_t A, long c, long prec) - void acb_mat_scalar_mul_si(acb_mat_t B, const acb_mat_t A, long c, long prec) - void acb_mat_scalar_div_si(acb_mat_t B, const acb_mat_t A, long c, long prec) - void acb_mat_scalar_addmul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec) - void acb_mat_scalar_mul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec) - void acb_mat_scalar_div_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec) - void acb_mat_scalar_addmul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec) - void acb_mat_scalar_mul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec) - void acb_mat_scalar_div_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec) - - int acb_mat_lu(long * P, acb_mat_t LU, const acb_mat_t A, long prec) - void acb_mat_solve_lu_precomp(acb_mat_t X, const long * perm, const acb_mat_t A, const acb_mat_t B, long prec) - int acb_mat_solve(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) - int acb_mat_solve_lu(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) - int acb_mat_solve_precond(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) - int acb_mat_inv(acb_mat_t X, const acb_mat_t A, long prec) - void acb_mat_det(acb_t det, const acb_mat_t A, long prec) - - void acb_mat_exp(acb_mat_t B, const acb_mat_t A, long prec) - - void _acb_mat_charpoly(acb_ptr cp, const acb_mat_t mat, long prec) - void acb_mat_charpoly(acb_poly_t cp, const acb_mat_t mat, long prec) - - - void acb_mat_conjugate(acb_mat_t mat1, const acb_mat_t mat2) - void acb_mat_transpose(acb_mat_t B, const acb_mat_t A) - void acb_mat_trace(acb_t trace, const acb_mat_t mat, long prec) - void acb_mat_get_mid(acb_mat_t B, const acb_mat_t A) - - void acb_mat_dft(acb_mat_t res, int kind, long prec) - - void acb_mat_frobenius_norm(arb_t res, const acb_mat_t A, long prec) - - int acb_mat_eq(const acb_mat_t mat1, const acb_mat_t mat2) - int acb_mat_ne(const acb_mat_t mat1, const acb_mat_t mat2) - int acb_mat_equal(const acb_mat_t mat1, const acb_mat_t mat2) - - int acb_mat_approx_solve(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) - - void acb_mat_randtest_eig(acb_mat_t A, flint_rand_t state, acb_srcptr E, long prec) - int acb_mat_approx_eig_qr(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, const mag_t tol, long maxiter, long prec) - void acb_mat_eig_global_enclosure(mag_t eps, const acb_mat_t A, acb_srcptr E, const acb_mat_t R, long prec) - - int acb_mat_eig_simple_rump(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) - int acb_mat_eig_simple_vdhoeven_mourrain(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) - int acb_mat_eig_simple(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) - - int acb_mat_eig_multiple_rump(acb_ptr E, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) - int acb_mat_eig_multiple(acb_ptr E, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) - - -cdef extern from "acb_modular.h": - void acb_modular_theta(acb_t theta1, acb_t theta2, acb_t theta3, acb_t theta4, const acb_t z, const acb_t tau, long prec) - void acb_modular_theta_jet(acb_ptr theta1, acb_ptr theta2, acb_ptr theta3, acb_ptr theta4, const acb_t z, const acb_t tau, long len, long prec) - void acb_modular_theta_series(acb_poly_t theta1, acb_poly_t theta2, acb_poly_t theta3, acb_poly_t theta4, const acb_poly_t z, const acb_t tau, long len, long prec) - void acb_modular_eta(acb_t r, const acb_t tau, long prec) - void acb_modular_j(acb_t r, const acb_t tau, long prec) - void acb_modular_lambda(acb_t r, const acb_t tau, long prec) - void acb_modular_delta(acb_t r, const acb_t tau, long prec) - void acb_modular_eisenstein(acb_ptr r, const acb_t tau, long len, long prec) - void acb_modular_elliptic_p(acb_t wp, const acb_t z, const acb_t tau, long prec) - void acb_modular_elliptic_p_zpx(acb_ptr wp, const acb_t z, const acb_t tau, long len, long prec) - void acb_modular_elliptic_k(acb_t w, const acb_t m, long prec) - void acb_modular_elliptic_k_cpx(acb_ptr w, const acb_t m, long len, long prec) - void acb_modular_elliptic_e(acb_t w, const acb_t m, long prec) - void acb_modular_hilbert_class_poly(fmpz_poly_t res, long D) - -cdef extern from "acb_hypgeom.h": - void acb_hypgeom_bessel_j(acb_t res, const acb_t nu, const acb_t z, long prec) - void acb_hypgeom_bessel_k(acb_t res, const acb_t nu, const acb_t z, long prec) - void acb_hypgeom_bessel_i(acb_t res, const acb_t nu, const acb_t z, long prec) - void acb_hypgeom_bessel_y(acb_t res, const acb_t nu, const acb_t z, long prec) - - void acb_hypgeom_bessel_k_scaled(acb_t res, const acb_t nu, const acb_t z, long prec) - void acb_hypgeom_bessel_i_scaled(acb_t res, const acb_t nu, const acb_t z, long prec) - - void acb_hypgeom_erf(acb_t res, const acb_t z, long prec) - void acb_hypgeom_pfq_direct(acb_t res, acb_srcptr a, long p, acb_srcptr b, long q, const acb_t z, long n, long prec) - void acb_hypgeom_u_asymp(acb_t res, const acb_t a, const acb_t b, const acb_t z, long n, long prec) - void acb_hypgeom_u(acb_t res, const acb_t a, const acb_t b, const acb_t z, long prec) - void acb_hypgeom_m(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, long prec) - void acb_hypgeom_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, long prec) - - long acb_hypgeom_pfq_choose_n(acb_srcptr a, long p, acb_srcptr b, long q, const acb_t z, long prec) - void acb_hypgeom_pfq(acb_t res, acb_srcptr a, long p, acb_srcptr b, long q, const acb_t z, int regularized, long prec) - void acb_hypgeom_gamma_upper(acb_t res, const acb_t s, const acb_t z, int modified, long prec) - void acb_hypgeom_gamma_upper_asymp(acb_t res, const acb_t s, const acb_t z, int modified, long prec) - void acb_hypgeom_expint(acb_t res, const acb_t s, const acb_t z, long prec) - void acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int modified, long prec) - void acb_hypgeom_beta_lower(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, long prec) - void acb_hypgeom_erfc(acb_t res, const acb_t z, long prec) - void acb_hypgeom_erfi(acb_t res, const acb_t z, long prec) - void acb_hypgeom_pfq_series_direct(acb_poly_t res, const acb_poly_struct * a, long p, const acb_poly_struct * b, long q, const acb_poly_t z, int regularized, long n, long len, long prec) - void acb_hypgeom_ei(acb_t res, const acb_t z, long prec) - void acb_hypgeom_si(acb_t res, const acb_t z, long prec) - void acb_hypgeom_ci(acb_t res, const acb_t z, long prec) - void acb_hypgeom_shi(acb_t res, const acb_t z, long prec) - void acb_hypgeom_chi(acb_t res, const acb_t z, long prec) - void acb_hypgeom_li(acb_t res, const acb_t z, int offset, long prec) - void acb_hypgeom_2f1(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, long prec) - void acb_hypgeom_0f1(acb_t res, const acb_t a, const acb_t z, int regularized, long prec) - void acb_hypgeom_legendre_p(acb_t res, const acb_t n, const acb_t m, const acb_t z, int type, long prec) - void acb_hypgeom_legendre_q(acb_t res, const acb_t n, const acb_t m, const acb_t z, int type, long prec) - void acb_hypgeom_spherical_y(acb_t res, long n, long m, const acb_t theta, const acb_t phi, long prec) - void acb_hypgeom_jacobi_p(acb_t res, const acb_t n, const acb_t a, const acb_t b, const acb_t z, long prec) - void acb_hypgeom_gegenbauer_c(acb_t res, const acb_t n, const acb_t m, const acb_t z, long prec) - void acb_hypgeom_laguerre_l(acb_t res, const acb_t n, const acb_t m, const acb_t z, long prec) - void acb_hypgeom_hermite_h(acb_t res, const acb_t n, const acb_t z, long prec) - void acb_hypgeom_chebyshev_t(acb_t res, const acb_t n, const acb_t z, long prec) - void acb_hypgeom_chebyshev_u(acb_t res, const acb_t n, const acb_t z, long prec) - - void acb_hypgeom_airy_bound(mag_t ai, mag_t aip, mag_t bi, mag_t bip, const acb_t z) - void acb_hypgeom_airy_asymp(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, long n, long prec) - void acb_hypgeom_airy_direct(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, long n, long prec) - void acb_hypgeom_airy(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, long prec) - void acb_hypgeom_airy_jet(acb_ptr ai, acb_ptr bi, const acb_t z, long len, long prec) - void _acb_hypgeom_airy_series(acb_ptr ai, acb_ptr ai_prime, acb_ptr bi, acb_ptr bi_prime, acb_srcptr z, long zlen, long len, long prec) - void acb_hypgeom_airy_series(acb_poly_t ai, acb_poly_t ai_prime, acb_poly_t bi, acb_poly_t bi_prime, const acb_poly_t z, long len, long prec) - - void acb_hypgeom_coulomb(acb_t F, acb_t G, acb_t Hpos, acb_t Hneg, const acb_t l, const acb_t eta, const acb_t z, long prec) - void acb_hypgeom_coulomb_series(acb_poly_t F, acb_poly_t G, acb_poly_t Hpos, acb_poly_t Hneg, const acb_t l, const acb_t eta, const acb_poly_t z, long len, long prec) - - void acb_hypgeom_erf_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - void acb_hypgeom_erfc_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - void acb_hypgeom_erfi_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - - void acb_hypgeom_fresnel(acb_t res1, acb_t res2, const acb_t z, int normalized, long prec) - void acb_hypgeom_fresnel_series(acb_poly_t res1, acb_poly_t res2, const acb_poly_t h, int normalized, long n, long prec) - - void _acb_hypgeom_gamma_upper_series(acb_ptr g, const acb_t s, acb_srcptr h, long hlen, int regularized, long n, long prec) - void acb_hypgeom_gamma_upper_series(acb_poly_t g, const acb_t s, const acb_poly_t h, int regularized, long n, long prec) - - void _acb_hypgeom_gamma_lower_series(acb_ptr g, const acb_t s, acb_srcptr h, long hlen, int regularized, long n, long prec) - void acb_hypgeom_gamma_lower_series(acb_poly_t g, const acb_t s, const acb_poly_t h, int regularized, long n, long prec) - - void _acb_hypgeom_beta_lower_series(acb_ptr g, const acb_t s, const acb_t t, acb_srcptr h, long hlen, int regularized, long n, long prec) - void acb_hypgeom_beta_lower_series(acb_poly_t g, const acb_t s, const acb_t t, const acb_poly_t h, int regularized, long n, long prec) - - void acb_hypgeom_ei_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - void acb_hypgeom_si_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - void acb_hypgeom_ci_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - void acb_hypgeom_shi_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - void acb_hypgeom_chi_series(acb_poly_t res, const acb_poly_t h, long n, long prec) - void acb_hypgeom_li_series(acb_poly_t res, const acb_poly_t h, int offset, long n, long prec) - -cdef extern from "arb_hypgeom.h": - void arb_hypgeom_pfq(arb_t res, arb_srcptr a, long p, arb_srcptr b, long q, const arb_t z, int regularized, long prec) - void arb_hypgeom_0f1(arb_t res, const arb_t a, const arb_t z, int regularized, long prec) - void arb_hypgeom_m(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, long prec) - void arb_hypgeom_1f1(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, long prec) - void arb_hypgeom_u(arb_t res, const arb_t a, const arb_t b, const arb_t z, long prec) - void arb_hypgeom_2f1(arb_t res, const arb_t a, const arb_t b, const arb_t c, const arb_t z, int regularized, long prec) - - void arb_hypgeom_erf(arb_t res, const arb_t z, long prec) - void arb_hypgeom_erf_series(arb_poly_t g, const arb_poly_t h, long len, long prec) - void arb_hypgeom_erfc(arb_t res, const arb_t z, long prec) - void arb_hypgeom_erfc_series(arb_poly_t g, const arb_poly_t h, long len, long prec) - void arb_hypgeom_erfi(arb_t res, const arb_t z, long prec) - void arb_hypgeom_erfi_series(arb_poly_t g, const arb_poly_t h, long len, long prec) - void arb_hypgeom_fresnel(arb_t res1, arb_t res2, const arb_t z, int normalized, long prec) - void arb_hypgeom_fresnel_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, int normalized, long len, long prec) - - void arb_hypgeom_ei(arb_t res, const arb_t z, long prec) - void arb_hypgeom_si(arb_t res, const arb_t z, long prec) - void arb_hypgeom_ci(arb_t res, const arb_t z, long prec) - void arb_hypgeom_shi(arb_t res, const arb_t z, long prec) - void arb_hypgeom_chi(arb_t res, const arb_t z, long prec) - void arb_hypgeom_li(arb_t res, const arb_t z, int offset, long prec) - void arb_hypgeom_ei_series(arb_poly_t res, const arb_poly_t h, long n, long prec) - void arb_hypgeom_si_series(arb_poly_t res, const arb_poly_t h, long n, long prec) - void arb_hypgeom_ci_series(arb_poly_t res, const arb_poly_t h, long n, long prec) - void arb_hypgeom_shi_series(arb_poly_t res, const arb_poly_t h, long n, long prec) - void arb_hypgeom_chi_series(arb_poly_t res, const arb_poly_t h, long n, long prec) - void arb_hypgeom_li_series(arb_poly_t res, const arb_poly_t h, int offset, long n, long prec) - - void arb_hypgeom_bessel_j(arb_t res, const arb_t nu, const arb_t z, long prec) - void arb_hypgeom_bessel_k(arb_t res, const arb_t nu, const arb_t z, long prec) - void arb_hypgeom_bessel_i(arb_t res, const arb_t nu, const arb_t z, long prec) - void arb_hypgeom_bessel_y(arb_t res, const arb_t nu, const arb_t z, long prec) - - void arb_hypgeom_bessel_k_scaled(arb_t res, const arb_t nu, const arb_t z, long prec) - void arb_hypgeom_bessel_i_scaled(arb_t res, const arb_t nu, const arb_t z, long prec) - - void arb_hypgeom_airy(arb_t ai, arb_t aip, arb_t bi, arb_t bip, const arb_t z, long prec) - void arb_hypgeom_airy_series(arb_poly_t ai, arb_poly_t ai_prime, arb_poly_t bi, arb_poly_t bi_prime, const arb_poly_t z, long len, long prec) - void arb_hypgeom_airy_zero(arb_t ai, arb_t aip, arb_t bi, arb_t bip, const fmpz_t n, long prec) - - void arb_hypgeom_coulomb(arb_t F, arb_t G, const arb_t l, const arb_t eta, const arb_t z, long prec) - void arb_hypgeom_coulomb_series(arb_poly_t F, arb_poly_t G, const arb_t l, const arb_t eta, const arb_poly_t z, long len, long prec) - - void arb_hypgeom_expint(arb_t res, const arb_t s, const arb_t z, long prec) - void arb_hypgeom_gamma_upper(arb_t res, const arb_t s, const arb_t z, int modified, long prec) - void arb_hypgeom_gamma_lower(arb_t res, const arb_t s, const arb_t z, int modified, long prec) - void arb_hypgeom_beta_lower(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, long prec) - - void arb_hypgeom_gamma_upper_series(arb_poly_t g, const arb_t s, const arb_poly_t h, int regularized, long n, long prec) - void arb_hypgeom_gamma_lower_series(arb_poly_t g, const arb_t s, const arb_poly_t h, int regularized, long n, long prec) - void arb_hypgeom_beta_lower_series(arb_poly_t g, const arb_t s, const arb_t t, const arb_poly_t h, int regularized, long n, long prec) - - void arb_hypgeom_chebyshev_t(arb_t res, const arb_t nu, const arb_t z, long prec) - void arb_hypgeom_chebyshev_u(arb_t res, const arb_t nu, const arb_t z, long prec) - void arb_hypgeom_jacobi_p(arb_t res, const arb_t n, const arb_t a, const arb_t b, const arb_t z, long prec) - void arb_hypgeom_gegenbauer_c(arb_t res, const arb_t n, const arb_t m, const arb_t z, long prec) - void arb_hypgeom_laguerre_l(arb_t res, const arb_t n, const arb_t m, const arb_t z, long prec) - void arb_hypgeom_hermite_h(arb_t res, const arb_t nu, const arb_t z, long prec) - void arb_hypgeom_legendre_p(arb_t res, const arb_t n, const arb_t m, const arb_t z, int type, long prec) - void arb_hypgeom_legendre_q(arb_t res, const arb_t n, const arb_t m, const arb_t z, int type, long prec) - - void arb_hypgeom_legendre_p_ui_root(arb_t res, arb_t weight, ulong n, ulong k, long prec) - -cdef extern from "dirichlet.h": - ctypedef struct dirichlet_group_struct: - ulong q - ulong q_even - nmod_t mod - ulong rad_q - ulong phi_q - long neven - long num - ulong expo - void * P - ulong * generators - ulong * PHI - ctypedef dirichlet_group_struct dirichlet_group_t[1] - - ctypedef struct dirichlet_char_struct: - ulong n - ulong * log - ctypedef dirichlet_char_struct dirichlet_char_t[1] - - ulong dirichlet_group_size(const dirichlet_group_t G) - void dirichlet_group_init(dirichlet_group_t G, ulong q) - void dirichlet_group_clear(dirichlet_group_t G) - ulong dirichlet_number_primitive(const dirichlet_group_t G) - - void dirichlet_char_init(dirichlet_char_t x, const dirichlet_group_t G) - void dirichlet_char_clear(dirichlet_char_t x) - void dirichlet_char_print(const dirichlet_group_t G, const dirichlet_char_t x) - - void dirichlet_char_set(dirichlet_char_t x, const dirichlet_group_t G, const dirichlet_char_t y) - int dirichlet_char_eq(const dirichlet_char_t x, const dirichlet_char_t y) - int dirichlet_parity_char(const dirichlet_group_t G, const dirichlet_char_t x) - ulong dirichlet_conductor_char(const dirichlet_group_t G, const dirichlet_char_t x) - ulong dirichlet_order_char(const dirichlet_group_t G, const dirichlet_char_t x) - - void dirichlet_char_log(dirichlet_char_t x, const dirichlet_group_t G, ulong m) - ulong dirichlet_char_exp(const dirichlet_group_t G, const dirichlet_char_t x) - ulong _dirichlet_char_exp(dirichlet_char_t x, const dirichlet_group_t G) - void dirichlet_char_index(dirichlet_char_t x, const dirichlet_group_t G, ulong j) - ulong dirichlet_index_char(const dirichlet_group_t G, const dirichlet_char_t x) - void dirichlet_char_one(dirichlet_char_t x, const dirichlet_group_t G) - void dirichlet_char_first_primitive(dirichlet_char_t x, const dirichlet_group_t G) - int dirichlet_char_next(dirichlet_char_t x, const dirichlet_group_t G) - int dirichlet_char_next_primitive(dirichlet_char_t x, const dirichlet_group_t G) - void dirichlet_char_mul(dirichlet_char_t c, const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b) - void dirichlet_char_pow(dirichlet_char_t c, const dirichlet_group_t G, const dirichlet_char_t a, ulong n) - void dirichlet_char_lower(dirichlet_char_t y, const dirichlet_group_t H, const dirichlet_char_t x, const dirichlet_group_t G) - void dirichlet_char_lift(dirichlet_char_t y, const dirichlet_group_t G, const dirichlet_char_t x, const dirichlet_group_t H) - - cdef ulong DIRICHLET_CHI_NULL - - ulong dirichlet_pairing(const dirichlet_group_t G, ulong m, ulong n) - ulong dirichlet_pairing_char(const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b) - - int dirichlet_char_is_principal(const dirichlet_group_t G, const dirichlet_char_t chi) - int dirichlet_char_is_real(const dirichlet_group_t G, const dirichlet_char_t chi) - int dirichlet_char_is_primitive(const dirichlet_group_t G, const dirichlet_char_t chi) - ulong dirichlet_chi(const dirichlet_group_t G, const dirichlet_char_t chi, ulong n) - -cdef extern from "acb_dirichlet.h": - void acb_dirichlet_eta(acb_t res, const acb_t s, long prec) - void acb_dirichlet_chi(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, ulong n, long prec) - - void acb_dirichlet_l(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, long prec) - void acb_dirichlet_hardy_z(acb_ptr res, const acb_t t, const dirichlet_group_t G, const dirichlet_char_t chi, long len, long prec) - void acb_dirichlet_l_series(acb_poly_t res, const acb_poly_t s, const dirichlet_group_t G, const dirichlet_char_t chi, int deflate, long len, long prec) - - void acb_dirichlet_stieltjes(acb_t res, const fmpz_t n, const acb_t a, long prec) - - void acb_dirichlet_gram_point(arb_t res, const fmpz_t n, const dirichlet_group_t G, const dirichlet_char_t chi, long prec) - void acb_dirichlet_zeta_zeros(acb_ptr res, const fmpz_t n, long len, long prec) - void acb_dirichlet_zeta_nzeros(arb_t res, const arb_t t, long prec) - void acb_dirichlet_backlund_s(arb_t res, const arb_t t, long prec) - void acb_dirichlet_zeta_zero(acb_t res, const fmpz_t n, long prec) - void acb_dirichlet_zeta_zeros(acb_ptr res, const fmpz_t n, long len, long prec) - -cdef extern from "acb_elliptic.h": - void acb_elliptic_rf(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, long prec) - void acb_elliptic_rj(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, long prec) - void acb_elliptic_rg(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, long prec) - void acb_elliptic_f(acb_t res, const acb_t phi, const acb_t m, int times_pi, long prec) - void acb_elliptic_e_inc(acb_t res, const acb_t phi, const acb_t m, int times_pi, long prec) - void acb_elliptic_pi(acb_t res, const acb_t n, const acb_t m, long prec) - void acb_elliptic_pi_inc(acb_t res, const acb_t n, const acb_t phi, const acb_t m, int times_pi, long prec) - void acb_elliptic_p(acb_t res, const acb_t z, const acb_t tau, long prec) - void acb_elliptic_zeta(acb_t res, const acb_t z, const acb_t tau, long prec) - void acb_elliptic_sigma(acb_t res, const acb_t z, const acb_t tau, long prec) - void acb_elliptic_roots(acb_t e1, acb_t e2, acb_t e3, const acb_t tau, long prec) - void acb_elliptic_invariants(acb_t g2, acb_t g3, const acb_t tau, long prec) - void acb_elliptic_inv_p(acb_t res, const acb_t z, const acb_t tau, long prec) - -cdef extern from "acb_calc.h": - ctypedef int (*acb_calc_func_t)(acb_ptr out, const acb_t inp, void * param, long order, long prec) - - ctypedef struct acb_calc_integrate_opt_struct: - long deg_limit - long eval_limit - long depth_limit - int use_heap - int verbose - - ctypedef acb_calc_integrate_opt_struct acb_calc_integrate_opt_t[1] - - void acb_calc_integrate_opt_init(acb_calc_integrate_opt_t options) - - int acb_calc_integrate(acb_t res, acb_calc_func_t f, void * param, - const acb_t a, const acb_t b, - long goal, const mag_t tol, - const acb_calc_integrate_opt_t options, - long prec) - -cdef extern from "arb_fmpz_poly.h": - void arb_fmpz_poly_evaluate_arb(arb_t res, const fmpz_poly_t poly, const arb_t x, long prec) - void arb_fmpz_poly_evaluate_acb(acb_t res, const fmpz_poly_t poly, const acb_t x, long prec) - void arb_fmpz_poly_complex_roots(acb_ptr roots, const fmpz_poly_t poly, int flags, long prec) - ulong arb_fmpz_poly_deflation(const fmpz_poly_t poly) - void arb_fmpz_poly_deflate(fmpz_poly_t res, const fmpz_poly_t poly, ulong deflation) - -cdef extern from "acb_dft.h": - void acb_dft(acb_ptr w, acb_srcptr v, long n, long prec) - void acb_dft_inverse(acb_ptr w, acb_srcptr v, long n, long prec) - -cdef extern from "flint/mpoly.h": - ctypedef enum ordering_t: - ORD_LEX - ORD_DEGLEX - ORD_DEGREVLEX - - ctypedef struct mpoly_ctx_struct: - slong nvars - slong nfields - ordering_t ord - int deg - int rev - slong lut_words_per_exp[FLINT_BITS] - unsigned char lut_fix_bits[FLINT_BITS] - - ctypedef mpoly_ctx_struct mpoly_ctx_t[1] - - void mpoly_ctx_init(mpoly_ctx_t ctx, slong nvars, const ordering_t ord) - void mpoly_ctx_clear(mpoly_ctx_t mctx) - - -cdef extern from "flint/fmpz_mpoly.h": - ctypedef struct fmpz_mpoly_ctx_struct: - mpoly_ctx_t minfo - - ctypedef fmpz_mpoly_ctx_struct fmpz_mpoly_ctx_t[1] - - ctypedef struct fmpz_mpoly_struct: - fmpz_struct * coeffs - ulong * exps - slong alloc - slong length - flint_bitcnt_t bits - - ctypedef fmpz_mpoly_struct fmpz_mpoly_t[1] - - void fmpz_mpoly_ctx_init(fmpz_mpoly_ctx_t ctx, slong nvars, const ordering_t ord) - void fmpz_mpoly_ctx_init_rand(fmpz_mpoly_ctx_t mctx, flint_rand_t state, slong max_nvars) - void fmpz_mpoly_ctx_clear(fmpz_mpoly_ctx_t ctx) - slong fmpz_mpoly_ctx_nvars(const fmpz_mpoly_ctx_t ctx) - ordering_t fmpz_mpoly_ctx_ord(const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_init(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_clear(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - - int fmpz_mpoly_set_str_pretty(fmpz_mpoly_t A, const char * str, const char ** x, const fmpz_mpoly_ctx_t ctx) - char * fmpz_mpoly_get_str_pretty(const fmpz_mpoly_t A, const char ** x, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_gen(fmpz_mpoly_t poly, slong i, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_is_gen(const fmpz_mpoly_t poly, slong k, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_equal(const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_swap(fmpz_mpoly_t A, fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - - slong fmpz_mpoly_max_bits(const fmpz_mpoly_t A) - - int fmpz_mpoly_is_fmpz(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_get_fmpz(fmpz_t c, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_fmpz(fmpz_mpoly_t A, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_ui(fmpz_mpoly_t A, ulong c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_si(fmpz_mpoly_t A, slong c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_zero(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_one(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_equal_fmpz(const fmpz_mpoly_t A, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_equal_ui(const fmpz_mpoly_t A, ulong c, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_equal_si(const fmpz_mpoly_t A, slong c, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_is_zero(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_is_one(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - - int fmpz_mpoly_degrees_fit_si(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_degrees_fmpz(fmpz_struct ** degs, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_degrees_si(slong * degs, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_degree_fmpz(fmpz_t deg, const fmpz_mpoly_t A, slong var, const fmpz_mpoly_ctx_t ctx) - slong fmpz_mpoly_degree_si(const fmpz_mpoly_t A, slong var, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_total_degree_fits_si(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_total_degree_fmpz(fmpz_t td, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - slong fmpz_mpoly_total_degree_si(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_get_coeff_fmpz_monomial(fmpz_t c, const fmpz_mpoly_t A, const fmpz_mpoly_t M, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_coeff_fmpz_monomial(fmpz_mpoly_t A, const fmpz_t c, const fmpz_mpoly_t M, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_get_coeff_fmpz_fmpz(fmpz_t c, const fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) - ulong fmpz_mpoly_get_coeff_ui_fmpz(const fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) - slong fmpz_mpoly_get_coeff_si_fmpz(const fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_get_coeff_fmpz_ui(fmpz_t c, const fmpz_mpoly_t A, const ulong * exp, const fmpz_mpoly_ctx_t ctx) - ulong fmpz_mpoly_get_coeff_ui_ui(const fmpz_mpoly_t A, const ulong * exp, const fmpz_mpoly_ctx_t ctx) - slong fmpz_mpoly_get_coeff_si_ui(const fmpz_mpoly_t A, - const ulong * exp, const fmpz_mpoly_ctx_t ctx) - void _fmpz_mpoly_set_coeff_fmpz_fmpz(fmpz_mpoly_t A, - const fmpz_t c, const fmpz_struct * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_coeff_fmpz_fmpz(fmpz_mpoly_t A, - const fmpz_t c, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_coeff_ui_fmpz(fmpz_mpoly_t A, - const ulong c, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_coeff_si_fmpz(fmpz_mpoly_t A, - const slong c, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_coeff_fmpz_ui(fmpz_mpoly_t A, - const fmpz_t c, const ulong * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_coeff_ui_ui(fmpz_mpoly_t A, - const ulong c, const ulong * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_set_coeff_si_ui(fmpz_mpoly_t A, - const slong c, const ulong * exp, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_get_coeff_vars_ui(fmpz_mpoly_t C, - const fmpz_mpoly_t A, slong * vars, ulong * exps, slong length, - const fmpz_mpoly_ctx_t ctx) - - int fmpz_mpoly_cmp(const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - - slong fmpz_mpoly_length(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_get_term_coeff_fmpz(fmpz_t c, const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_get_term_exp_fmpz(fmpz_struct ** exp, const fmpz_mpoly_t A, - slong i, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_get_term_exp_ui(ulong * exp, const fmpz_mpoly_t A, - slong i, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_get_term_exp_si(slong * exp, const fmpz_mpoly_t A, - slong i, const fmpz_mpoly_ctx_t ctx) - - ulong fmpz_mpoly_get_term_var_exp_ui(const fmpz_mpoly_t A, slong i, - slong var, const fmpz_mpoly_ctx_t ctx) - - slong fmpz_mpoly_get_term_var_exp_si(const fmpz_mpoly_t A, slong i, - slong var, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_set_term_exp_fmpz(fmpz_mpoly_t A, - slong i, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_set_term_exp_ui(fmpz_mpoly_t A, - slong i, const ulong * exp, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_get_term(fmpz_mpoly_t M, const fmpz_mpoly_t A, - slong i, const fmpz_mpoly_ctx_t ctx) - - void fmpz_mpoly_get_term_monomial(fmpz_mpoly_t M, const fmpz_mpoly_t A, - slong i, const fmpz_mpoly_ctx_t ctx) - - # Addition/Subtraction - void fmpz_mpoly_add_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_add_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_sub_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_sub_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_add(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_t C, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_sub(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_t C, const fmpz_mpoly_ctx_t ctx) - - # Scalar operations - void fmpz_mpoly_neg(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_scalar_mul_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_scalar_mul_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_scalar_mul_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_scalar_divexact_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_scalar_divexact_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_scalar_divexact_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong c, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_scalar_divides_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_scalar_divides_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_scalar_divides_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong c, const fmpz_mpoly_ctx_t ctx) - - # Differentiation/Integration - void fmpz_mpoly_derivative(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong var, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_integral(fmpz_mpoly_t A, fmpz_t scale, const fmpz_mpoly_t B, slong var, const fmpz_mpoly_ctx_t ctx) - - # Evaluation - int fmpz_mpoly_evaluate_all_fmpz(fmpz_t ev, const fmpz_mpoly_t A, fmpz_struct * const * vals, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_evaluate_one_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong var, const fmpz_t val, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_compose_fmpz_poly(fmpz_poly_t A, const fmpz_mpoly_t B, fmpz_poly_struct * const * C, const fmpz_mpoly_ctx_t ctxB) - int fmpz_mpoly_compose_fmpz_mpoly(fmpz_mpoly_t A, const fmpz_mpoly_t B, fmpz_mpoly_struct * const * C, const fmpz_mpoly_ctx_t ctxB, const fmpz_mpoly_ctx_t ctxAC) - void fmpz_mpoly_compose_fmpz_mpoly_gen(fmpz_mpoly_t A, const fmpz_mpoly_t B, const slong * c, const fmpz_mpoly_ctx_t ctxB, const fmpz_mpoly_ctx_t ctxAC) - - # Multiplication - void fmpz_mpoly_mul(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_t C, const fmpz_mpoly_ctx_t ctx) - - # Powering - int fmpz_mpoly_pow_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t k, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_pow_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong k, const fmpz_mpoly_ctx_t ctx) - - # Division - int fmpz_mpoly_divides(fmpz_mpoly_t Q, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_divrem(fmpz_mpoly_t Q, fmpz_mpoly_t R, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_quasidivrem(fmpz_t scale, fmpz_mpoly_t Q, fmpz_mpoly_t R, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_div(fmpz_mpoly_t Q, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_quasidiv(fmpz_t scale, fmpz_mpoly_t Q, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_divrem_ideal(fmpz_mpoly_struct ** Q, fmpz_mpoly_t R, const fmpz_mpoly_t A, fmpz_mpoly_struct * const * B, slong len, const fmpz_mpoly_ctx_t ctx) - void fmpz_mpoly_term_content(fmpz_mpoly_t M, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) - int fmpz_mpoly_gcd(fmpz_mpoly_t G, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) """ cdef extern from "flint/fmpz_mpoly_factor.h": diff --git a/src/flint/flint_base/flint_context.pxd b/src/flint/flint_base/flint_context.pxd index 2bcfcdb0..89bf34c0 100644 --- a/src/flint/flint_base/flint_context.pxd +++ b/src/flint/flint_base/flint_context.pxd @@ -1,4 +1,4 @@ -from flint._flint cimport ( +from flint.flintlib.arf cimport ( arf_rnd_t, ) diff --git a/src/flint/flint_base/flint_context.pyx b/src/flint/flint_base/flint_context.pyx index c86a5d10..60401492 100644 --- a/src/flint/flint_base/flint_context.pyx +++ b/src/flint/flint_base/flint_context.pyx @@ -1,5 +1,5 @@ +from flint.flintlib.arf cimport ARF_RND_DOWN from flint._flint cimport ( - ARF_RND_DOWN, flint_cleanup, flint_get_num_threads, flint_set_num_threads diff --git a/src/flint/flintlib/__init__.pxd b/src/flint/flintlib/__init__.pxd new file mode 100644 index 00000000..e69de29b diff --git a/src/flint/flintlib/__init__.py b/src/flint/flintlib/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/flint/flintlib/acb.pxd b/src/flint/flintlib/acb.pxd new file mode 100644 index 00000000..c74b3c03 --- /dev/null +++ b/src/flint/flintlib/acb.pxd @@ -0,0 +1,197 @@ +from flint._flint cimport ulong, slong +from flint.flintlib.arb cimport arb_struct, arb_t, arb_ptr +from flint.flintlib.fmpq cimport fmpq_t +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.arf cimport arf_t +from flint.flintlib.mag cimport mag_t + +cdef extern from "acb.h": + ctypedef struct acb_struct: + arb_struct real + arb_struct imag + + ctypedef acb_struct * acb_ptr + ctypedef const acb_struct * acb_srcptr + ctypedef acb_struct acb_t[1] + + arb_ptr acb_realref(const acb_t x) + arb_ptr acb_imagref(const acb_t x) + + acb_ptr _acb_vec_init(long n) + void _acb_vec_clear(acb_ptr v, long n) + void _acb_vec_sort_pretty(acb_ptr vec, long len) + void acb_printd(const acb_t z, long digits) + + void acb_init(acb_t x) + void acb_clear(acb_t x) + int acb_is_zero(const acb_t z) + int acb_is_one(const acb_t z) + int acb_is_exact(const acb_t z) + int acb_is_finite(const acb_t x) + void acb_indeterminate(acb_t x) + void acb_zero(acb_t z) + void acb_one(acb_t z) + void acb_onei(acb_t z) + void acb_set(acb_t z, const acb_t x) + void acb_set_round(acb_t z, const acb_t x, long prec) + void acb_neg_round(acb_t z, const acb_t x, long prec) + void acb_swap(acb_t z, acb_t x) + int acb_equal(const acb_t x, const acb_t y) + int acb_eq(const acb_t x, const acb_t y) + int acb_ne(const acb_t x, const acb_t y) + int acb_overlaps(const acb_t x, const acb_t y) + int acb_contains_zero(const acb_t x) + int acb_contains_fmpq(const acb_t x, const fmpq_t y) + int acb_contains_fmpz(const acb_t x, const fmpz_t y) + int acb_contains(const acb_t x, const acb_t y) + int acb_contains_interior(const acb_t x, const acb_t y) + int acb_get_unique_fmpz(fmpz_t z, const acb_t x) + int acb_contains_int(const acb_t x) + void acb_union(acb_t z, const acb_t x, const acb_t y, long prec) + void acb_set_ui(acb_t z, ulong c) + void acb_set_si(acb_t z, long c) + void acb_set_fmpz(acb_t z, const fmpz_t c) + void acb_set_round_fmpz(acb_t z, const fmpz_t y, long prec) + void acb_set_fmpq(acb_t z, const fmpq_t c, long prec) + void acb_set_arb(acb_t z, const arb_t c) + void acb_set_round_arb(acb_t z, const arb_t x, long prec) + void acb_trim(acb_t z, const acb_t x) + void acb_add_error_arf(acb_t x, const arf_t err) + void acb_add_error_mag(acb_t x, const mag_t err) + void acb_get_mag(mag_t z, const acb_t x) + void acb_get_mag_lower(mag_t z, const acb_t x) + void acb_get_abs_ubound_arf(arf_t u, const acb_t z, long prec) + void acb_get_abs_lbound_arf(arf_t u, const acb_t z, long prec) + void acb_get_rad_ubound_arf(arf_t u, const acb_t z, long prec) + void acb_arg(arb_t r, const acb_t z, long prec) + void acb_add(acb_t z, const acb_t x, const acb_t y, long prec) + void acb_sub(acb_t z, const acb_t x, const acb_t y, long prec) + void acb_add_ui(acb_t z, const acb_t x, ulong c, long prec) + void acb_sub_ui(acb_t z, const acb_t x, ulong c, long prec) + void acb_add_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) + void acb_add_arb(acb_t z, const acb_t x, const arb_t y, long prec) + void acb_sub_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) + void acb_sub_arb(acb_t z, const acb_t x, const arb_t y, long prec) + void acb_neg(acb_t z, const acb_t x) + void acb_conj(acb_t z, const acb_t x) + void acb_abs(arb_t u, const acb_t z, long prec) + void acb_sgn(acb_t u, const acb_t z, long prec) + void acb_csgn(arb_t u, const acb_t z) + void acb_get_real(arb_t u, const acb_t z) + void acb_get_imag(arb_t u, const acb_t z) + + void acb_real_abs(acb_t res, const acb_t z, int analytic, long prec) + void acb_real_sgn(acb_t res, const acb_t z, int analytic, long prec) + void acb_real_heaviside(acb_t res, const acb_t z, int analytic, long prec) + void acb_real_floor(acb_t res, const acb_t z, int analytic, long prec) + void acb_real_ceil(acb_t res, const acb_t z, int analytic, long prec) + void acb_real_max(acb_t res, const acb_t x, const acb_t y, int analytic, long prec) + void acb_real_min(acb_t res, const acb_t x, const acb_t y, int analytic, long prec) + void acb_real_sqrtpos(acb_t res, const acb_t z, int analytic, long prec) + + void acb_sqrt_analytic(acb_t res, const acb_t z, int analytic, long prec) + void acb_rsqrt_analytic(acb_t res, const acb_t z, int analytic, long prec) + void acb_log_analytic(acb_t res, const acb_t z, int analytic, long prec) + void acb_pow_analytic(acb_t res, const acb_t z, const acb_t w, int analytic, long prec) + + void acb_mul_ui(acb_t z, const acb_t x, ulong y, long prec) + void acb_mul_si(acb_t z, const acb_t x, long y, long prec) + void acb_mul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) + void acb_mul_arb(acb_t z, const acb_t x, const arb_t y, long prec) + void acb_mul_onei(acb_t z, const acb_t x) + void acb_mul(acb_t z, const acb_t x, const acb_t y, long prec) + void acb_mul_2exp_si(acb_t z, const acb_t x, long e) + void acb_mul_2exp_fmpz(acb_t z, const acb_t x, const fmpz_t c) + void acb_addmul(acb_t z, const acb_t x, const acb_t y, long prec) + void acb_submul(acb_t z, const acb_t x, const acb_t y, long prec) + void acb_addmul_ui(acb_t z, const acb_t x, ulong y, long prec) + void acb_addmul_si(acb_t z, const acb_t x, long y, long prec) + void acb_submul_ui(acb_t z, const acb_t x, ulong y, long prec) + void acb_submul_si(acb_t z, const acb_t x, long y, long prec) + void acb_addmul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) + void acb_submul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec) + void acb_addmul_arb(acb_t z, const acb_t x, const arb_t y, long prec) + void acb_submul_arb(acb_t z, const acb_t x, const arb_t y, long prec) + void acb_inv(acb_t z, const acb_t x, long prec) + void acb_div(acb_t z, const acb_t x, const acb_t y, long prec) + void acb_div_ui(acb_t z, const acb_t x, ulong c, long prec) + void acb_div_si(acb_t z, const acb_t x, long c, long prec) + void acb_div_arb(acb_t z, const acb_t x, const arb_t c, long prec) + void acb_div_fmpz(acb_t z, const acb_t x, const fmpz_t c, long prec) + void acb_cube(acb_t y, const acb_t x, long prec) + void acb_pow_fmpz(acb_t y, const acb_t b, const fmpz_t e, long prec) + void acb_pow_ui(acb_t y, const acb_t b, ulong e, long prec) + void acb_pow_si(acb_t y, const acb_t b, long e, long prec) + void acb_const_pi(acb_t x, long prec) + void acb_log(acb_t r, const acb_t z, long prec) + void acb_exp(acb_t r, const acb_t z, long prec) + void acb_exp_pi_i(acb_t r, const acb_t z, long prec) + void acb_sin(acb_t r, const acb_t z, long prec) + void acb_cos(acb_t r, const acb_t z, long prec) + void acb_sin_cos(acb_t s, acb_t c, const acb_t z, long prec) + void acb_tan(acb_t r, const acb_t z, long prec) + void acb_cot(acb_t r, const acb_t z, long prec) + void acb_sec(acb_t r, const acb_t z, long prec) + void acb_csc(acb_t r, const acb_t z, long prec) + void acb_sin_pi(acb_t r, const acb_t z, long prec) + void acb_cos_pi(acb_t r, const acb_t z, long prec) + void acb_sin_cos_pi(acb_t s, acb_t c, const acb_t z, long prec) + void acb_tan_pi(acb_t r, const acb_t z, long prec) + void acb_cot_pi(acb_t r, const acb_t z, long prec) + void acb_sinh(acb_t r, const acb_t z, long prec) + void acb_cosh(acb_t r, const acb_t z, long prec) + void acb_sinh_cosh(acb_t s, acb_t c, const acb_t z, long prec) + void acb_tanh(acb_t r, const acb_t z, long prec) + void acb_coth(acb_t r, const acb_t z, long prec) + void acb_sech(acb_t r, const acb_t z, long prec) + void acb_csch(acb_t r, const acb_t z, long prec) + void acb_sinc(acb_t r, const acb_t z, long prec) + void acb_sinc_pi(acb_t r, const acb_t z, long prec) + void acb_pow_arb(acb_t z, const acb_t x, const arb_t y, long prec) + void acb_pow(acb_t r, const acb_t x, const acb_t y, long prec) + void acb_sqrt(acb_t y, const acb_t x, long prec) + void acb_rsqrt(acb_t y, const acb_t x, long prec) + void acb_rising_ui_bs(acb_t y, const acb_t x, ulong n, long prec) + void acb_rising_ui_rs(acb_t y, const acb_t x, ulong n, ulong m, long prec) + void acb_rising_ui_rec(acb_t y, const acb_t x, ulong n, long prec) + void acb_rising_ui(acb_t z, const acb_t x, ulong n, long prec) + void acb_rising2_ui_bs(acb_t u, acb_t v, const acb_t x, ulong n, long prec) + void acb_rising2_ui_rs(acb_t u, acb_t v, const acb_t x, ulong n, ulong m, long prec) + void acb_rising2_ui(acb_t u, acb_t v, const acb_t x, ulong n, long prec) + void acb_rising_ui_get_mag(mag_t bound, const acb_t s, ulong n) + void acb_rising(acb_t y, const acb_t x, const acb_t n, long prec) + + void acb_gamma(acb_t y, const acb_t x, long prec) + void acb_rgamma(acb_t y, const acb_t x, long prec) + void acb_lgamma(acb_t y, const acb_t x, long prec) + void acb_digamma(acb_t y, const acb_t x, long prec) + void acb_zeta(acb_t z, const acb_t s, long prec) + void acb_hurwitz_zeta(acb_t z, const acb_t s, const acb_t a, long prec) + void acb_polylog(acb_t w, const acb_t s, const acb_t z, long prec) + void acb_polylog_si(acb_t w, long s, const acb_t z, long prec) + void acb_agm1(acb_t m, const acb_t z, long prec) + void acb_agm1_cpx(acb_ptr m, const acb_t z, long len, long prec) + void acb_agm(acb_t res, const acb_t a, const acb_t b, long prec) + void acb_expm1(acb_t r, const acb_t z, long prec) + void acb_log1p(acb_t r, const acb_t z, long prec) + void acb_asin(acb_t r, const acb_t z, long prec) + void acb_acos(acb_t r, const acb_t z, long prec) + void acb_atan(acb_t r, const acb_t z, long prec) + void acb_asinh(acb_t r, const acb_t z, long prec) + void acb_acosh(acb_t r, const acb_t z, long prec) + void acb_atanh(acb_t r, const acb_t z, long prec) + void acb_log_sin_pi(acb_t res, const acb_t z, long prec) + + void acb_polygamma(acb_t w, const acb_t s, const acb_t z, long prec) + void acb_log_barnes_g(acb_t w, const acb_t z, long prec) + void acb_barnes_g(acb_t w, const acb_t z, long prec) + + void acb_bernoulli_poly_ui(acb_t res, ulong n, const acb_t x, long prec) + + void acb_lambertw(acb_t z, const acb_t x, const fmpz_t k, int flags, long prec) + + long acb_rel_error_bits(const acb_t x) + long acb_rel_accuracy_bits(const acb_t x) + long acb_bits(const acb_t x) + + void acb_root_ui(acb_t z, const acb_t x, ulong k, long prec) diff --git a/src/flint/flintlib/acb_calc.pxd b/src/flint/flintlib/acb_calc.pxd new file mode 100644 index 00000000..18dd8fee --- /dev/null +++ b/src/flint/flintlib/acb_calc.pxd @@ -0,0 +1,22 @@ +from flint.flintlib.acb cimport acb_t, acb_ptr +from flint.flintlib.mag cimport mag_t + +cdef extern from "acb_calc.h": + ctypedef int (*acb_calc_func_t)(acb_ptr out, const acb_t inp, void * param, long order, long prec) + + ctypedef struct acb_calc_integrate_opt_struct: + long deg_limit + long eval_limit + long depth_limit + int use_heap + int verbose + + ctypedef acb_calc_integrate_opt_struct acb_calc_integrate_opt_t[1] + + void acb_calc_integrate_opt_init(acb_calc_integrate_opt_t options) + + int acb_calc_integrate(acb_t res, acb_calc_func_t f, void * param, + const acb_t a, const acb_t b, + long goal, const mag_t tol, + const acb_calc_integrate_opt_t options, + long prec) diff --git a/src/flint/flintlib/acb_dft.pxd b/src/flint/flintlib/acb_dft.pxd new file mode 100644 index 00000000..edbe3593 --- /dev/null +++ b/src/flint/flintlib/acb_dft.pxd @@ -0,0 +1,5 @@ +from flint.flintlib.acb cimport acb_ptr, acb_srcptr + +cdef extern from "acb_dft.h": + void acb_dft(acb_ptr w, acb_srcptr v, long n, long prec) + void acb_dft_inverse(acb_ptr w, acb_srcptr v, long n, long prec) diff --git a/src/flint/flintlib/acb_dirichlet.pxd b/src/flint/flintlib/acb_dirichlet.pxd new file mode 100644 index 00000000..74886cda --- /dev/null +++ b/src/flint/flintlib/acb_dirichlet.pxd @@ -0,0 +1,24 @@ +from flint.flintlib.acb cimport acb_t, acb_ptr +from flint.flintlib.dirichlet cimport dirichlet_group_t, dirichlet_char_t +from flint._flint cimport ulong +from flint.flintlib.acb_poly cimport acb_poly_t +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.arb cimport arb_t + + +cdef extern from "acb_dirichlet.h": + void acb_dirichlet_eta(acb_t res, const acb_t s, long prec) + void acb_dirichlet_chi(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, ulong n, long prec) + + void acb_dirichlet_l(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, long prec) + void acb_dirichlet_hardy_z(acb_ptr res, const acb_t t, const dirichlet_group_t G, const dirichlet_char_t chi, long len, long prec) + void acb_dirichlet_l_series(acb_poly_t res, const acb_poly_t s, const dirichlet_group_t G, const dirichlet_char_t chi, int deflate, long len, long prec) + + void acb_dirichlet_stieltjes(acb_t res, const fmpz_t n, const acb_t a, long prec) + + void acb_dirichlet_gram_point(arb_t res, const fmpz_t n, const dirichlet_group_t G, const dirichlet_char_t chi, long prec) + void acb_dirichlet_zeta_zeros(acb_ptr res, const fmpz_t n, long len, long prec) + void acb_dirichlet_zeta_nzeros(arb_t res, const arb_t t, long prec) + void acb_dirichlet_backlund_s(arb_t res, const arb_t t, long prec) + void acb_dirichlet_zeta_zero(acb_t res, const fmpz_t n, long prec) + void acb_dirichlet_zeta_zeros(acb_ptr res, const fmpz_t n, long len, long prec) diff --git a/src/flint/flintlib/acb_elliptic.pxd b/src/flint/flintlib/acb_elliptic.pxd new file mode 100644 index 00000000..d5f906dd --- /dev/null +++ b/src/flint/flintlib/acb_elliptic.pxd @@ -0,0 +1,16 @@ +from flint.flintlib.acb cimport acb_t + +cdef extern from "acb_elliptic.h": + void acb_elliptic_rf(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, long prec) + void acb_elliptic_rj(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, long prec) + void acb_elliptic_rg(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, long prec) + void acb_elliptic_f(acb_t res, const acb_t phi, const acb_t m, int times_pi, long prec) + void acb_elliptic_e_inc(acb_t res, const acb_t phi, const acb_t m, int times_pi, long prec) + void acb_elliptic_pi(acb_t res, const acb_t n, const acb_t m, long prec) + void acb_elliptic_pi_inc(acb_t res, const acb_t n, const acb_t phi, const acb_t m, int times_pi, long prec) + void acb_elliptic_p(acb_t res, const acb_t z, const acb_t tau, long prec) + void acb_elliptic_zeta(acb_t res, const acb_t z, const acb_t tau, long prec) + void acb_elliptic_sigma(acb_t res, const acb_t z, const acb_t tau, long prec) + void acb_elliptic_roots(acb_t e1, acb_t e2, acb_t e3, const acb_t tau, long prec) + void acb_elliptic_invariants(acb_t g2, acb_t g3, const acb_t tau, long prec) + void acb_elliptic_inv_p(acb_t res, const acb_t z, const acb_t tau, long prec) diff --git a/src/flint/flintlib/acb_hypgeom.pxd b/src/flint/flintlib/acb_hypgeom.pxd new file mode 100644 index 00000000..2e46ed57 --- /dev/null +++ b/src/flint/flintlib/acb_hypgeom.pxd @@ -0,0 +1,81 @@ +from flint.flintlib.acb cimport acb_t, acb_srcptr, acb_ptr +from flint.flintlib.acb_poly cimport acb_poly_t, acb_poly_struct +from flint.flintlib.mag cimport mag_t + +cdef extern from "acb_hypgeom.h": + void acb_hypgeom_bessel_j(acb_t res, const acb_t nu, const acb_t z, long prec) + void acb_hypgeom_bessel_k(acb_t res, const acb_t nu, const acb_t z, long prec) + void acb_hypgeom_bessel_i(acb_t res, const acb_t nu, const acb_t z, long prec) + void acb_hypgeom_bessel_y(acb_t res, const acb_t nu, const acb_t z, long prec) + + void acb_hypgeom_bessel_k_scaled(acb_t res, const acb_t nu, const acb_t z, long prec) + void acb_hypgeom_bessel_i_scaled(acb_t res, const acb_t nu, const acb_t z, long prec) + + void acb_hypgeom_erf(acb_t res, const acb_t z, long prec) + void acb_hypgeom_pfq_direct(acb_t res, acb_srcptr a, long p, acb_srcptr b, long q, const acb_t z, long n, long prec) + void acb_hypgeom_u_asymp(acb_t res, const acb_t a, const acb_t b, const acb_t z, long n, long prec) + void acb_hypgeom_u(acb_t res, const acb_t a, const acb_t b, const acb_t z, long prec) + void acb_hypgeom_m(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, long prec) + void acb_hypgeom_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, long prec) + + long acb_hypgeom_pfq_choose_n(acb_srcptr a, long p, acb_srcptr b, long q, const acb_t z, long prec) + void acb_hypgeom_pfq(acb_t res, acb_srcptr a, long p, acb_srcptr b, long q, const acb_t z, int regularized, long prec) + void acb_hypgeom_gamma_upper(acb_t res, const acb_t s, const acb_t z, int modified, long prec) + void acb_hypgeom_gamma_upper_asymp(acb_t res, const acb_t s, const acb_t z, int modified, long prec) + void acb_hypgeom_expint(acb_t res, const acb_t s, const acb_t z, long prec) + void acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int modified, long prec) + void acb_hypgeom_beta_lower(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, long prec) + void acb_hypgeom_erfc(acb_t res, const acb_t z, long prec) + void acb_hypgeom_erfi(acb_t res, const acb_t z, long prec) + void acb_hypgeom_pfq_series_direct(acb_poly_t res, const acb_poly_struct * a, long p, const acb_poly_struct * b, long q, const acb_poly_t z, int regularized, long n, long len, long prec) + void acb_hypgeom_ei(acb_t res, const acb_t z, long prec) + void acb_hypgeom_si(acb_t res, const acb_t z, long prec) + void acb_hypgeom_ci(acb_t res, const acb_t z, long prec) + void acb_hypgeom_shi(acb_t res, const acb_t z, long prec) + void acb_hypgeom_chi(acb_t res, const acb_t z, long prec) + void acb_hypgeom_li(acb_t res, const acb_t z, int offset, long prec) + void acb_hypgeom_2f1(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, long prec) + void acb_hypgeom_0f1(acb_t res, const acb_t a, const acb_t z, int regularized, long prec) + void acb_hypgeom_legendre_p(acb_t res, const acb_t n, const acb_t m, const acb_t z, int type, long prec) + void acb_hypgeom_legendre_q(acb_t res, const acb_t n, const acb_t m, const acb_t z, int type, long prec) + void acb_hypgeom_spherical_y(acb_t res, long n, long m, const acb_t theta, const acb_t phi, long prec) + void acb_hypgeom_jacobi_p(acb_t res, const acb_t n, const acb_t a, const acb_t b, const acb_t z, long prec) + void acb_hypgeom_gegenbauer_c(acb_t res, const acb_t n, const acb_t m, const acb_t z, long prec) + void acb_hypgeom_laguerre_l(acb_t res, const acb_t n, const acb_t m, const acb_t z, long prec) + void acb_hypgeom_hermite_h(acb_t res, const acb_t n, const acb_t z, long prec) + void acb_hypgeom_chebyshev_t(acb_t res, const acb_t n, const acb_t z, long prec) + void acb_hypgeom_chebyshev_u(acb_t res, const acb_t n, const acb_t z, long prec) + + void acb_hypgeom_airy_bound(mag_t ai, mag_t aip, mag_t bi, mag_t bip, const acb_t z) + void acb_hypgeom_airy_asymp(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, long n, long prec) + void acb_hypgeom_airy_direct(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, long n, long prec) + void acb_hypgeom_airy(acb_t ai, acb_t aip, acb_t bi, acb_t bip, const acb_t z, long prec) + void acb_hypgeom_airy_jet(acb_ptr ai, acb_ptr bi, const acb_t z, long len, long prec) + void _acb_hypgeom_airy_series(acb_ptr ai, acb_ptr ai_prime, acb_ptr bi, acb_ptr bi_prime, acb_srcptr z, long zlen, long len, long prec) + void acb_hypgeom_airy_series(acb_poly_t ai, acb_poly_t ai_prime, acb_poly_t bi, acb_poly_t bi_prime, const acb_poly_t z, long len, long prec) + + void acb_hypgeom_coulomb(acb_t F, acb_t G, acb_t Hpos, acb_t Hneg, const acb_t l, const acb_t eta, const acb_t z, long prec) + void acb_hypgeom_coulomb_series(acb_poly_t F, acb_poly_t G, acb_poly_t Hpos, acb_poly_t Hneg, const acb_t l, const acb_t eta, const acb_poly_t z, long len, long prec) + + void acb_hypgeom_erf_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + void acb_hypgeom_erfc_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + void acb_hypgeom_erfi_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + + void acb_hypgeom_fresnel(acb_t res1, acb_t res2, const acb_t z, int normalized, long prec) + void acb_hypgeom_fresnel_series(acb_poly_t res1, acb_poly_t res2, const acb_poly_t h, int normalized, long n, long prec) + + void _acb_hypgeom_gamma_upper_series(acb_ptr g, const acb_t s, acb_srcptr h, long hlen, int regularized, long n, long prec) + void acb_hypgeom_gamma_upper_series(acb_poly_t g, const acb_t s, const acb_poly_t h, int regularized, long n, long prec) + + void _acb_hypgeom_gamma_lower_series(acb_ptr g, const acb_t s, acb_srcptr h, long hlen, int regularized, long n, long prec) + void acb_hypgeom_gamma_lower_series(acb_poly_t g, const acb_t s, const acb_poly_t h, int regularized, long n, long prec) + + void _acb_hypgeom_beta_lower_series(acb_ptr g, const acb_t s, const acb_t t, acb_srcptr h, long hlen, int regularized, long n, long prec) + void acb_hypgeom_beta_lower_series(acb_poly_t g, const acb_t s, const acb_t t, const acb_poly_t h, int regularized, long n, long prec) + + void acb_hypgeom_ei_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + void acb_hypgeom_si_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + void acb_hypgeom_ci_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + void acb_hypgeom_shi_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + void acb_hypgeom_chi_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + void acb_hypgeom_li_series(acb_poly_t res, const acb_poly_t h, int offset, long n, long prec) diff --git a/src/flint/flintlib/acb_mat.pxd b/src/flint/flintlib/acb_mat.pxd new file mode 100644 index 00000000..fa2023e4 --- /dev/null +++ b/src/flint/flintlib/acb_mat.pxd @@ -0,0 +1,97 @@ +from flint._flint cimport ulong, flint_rand_t +from flint.flintlib.fmpz_mat cimport fmpz_mat_t +from flint.flintlib.fmpq_mat cimport fmpq_mat_t +from flint.flintlib.mag cimport mag_t +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.acb_poly cimport acb_poly_t +from flint.flintlib.arb cimport arb_t +from flint.flintlib.acb cimport acb_ptr, acb_struct, acb_t, acb_srcptr + +cdef extern from "acb_mat.h": + ctypedef struct acb_mat_struct: + acb_ptr entries + long r + long c + acb_ptr * rows + + ctypedef acb_mat_struct acb_mat_t[1] + + acb_struct * acb_mat_entry(acb_mat_t mat, long i, long j) + + long acb_mat_nrows(const acb_mat_t x) + long acb_mat_ncols(const acb_mat_t x) + + void acb_mat_init(acb_mat_t mat, long r, long c) + void acb_mat_clear(acb_mat_t mat) + + void acb_mat_set(acb_mat_t dest, const acb_mat_t src) + void acb_mat_set_fmpz_mat(acb_mat_t dest, const fmpz_mat_t src) + void acb_mat_set_fmpq_mat(acb_mat_t dest, const fmpq_mat_t src, long prec) + void acb_mat_printd(const acb_mat_t mat, long digits) + int acb_mat_equal(const acb_mat_t mat1, const acb_mat_t mat2) + int acb_mat_overlaps(const acb_mat_t mat1, const acb_mat_t mat2) + int acb_mat_contains(const acb_mat_t mat1, const acb_mat_t mat2) + int acb_mat_contains_fmpq_mat(const acb_mat_t mat1, const fmpq_mat_t mat2) + int acb_mat_contains_fmpz_mat(const acb_mat_t mat1, const fmpz_mat_t mat2) + + void acb_mat_zero(acb_mat_t mat) + void acb_mat_one(acb_mat_t mat) + + void acb_mat_bound_inf_norm(mag_t b, const acb_mat_t A) + + void acb_mat_neg(acb_mat_t dest, const acb_mat_t src) + void acb_mat_add(acb_mat_t res, const acb_mat_t mat1, const acb_mat_t mat2, long prec) + void acb_mat_sub(acb_mat_t res, const acb_mat_t mat1, const acb_mat_t mat2, long prec) + void acb_mat_mul(acb_mat_t res, const acb_mat_t mat1, const acb_mat_t mat2, long prec) + void acb_mat_pow_ui(acb_mat_t B, const acb_mat_t A, ulong exp, long prec) + + void acb_mat_scalar_mul_2exp_si(acb_mat_t B, const acb_mat_t A, long c) + void acb_mat_scalar_addmul_si(acb_mat_t B, const acb_mat_t A, long c, long prec) + void acb_mat_scalar_mul_si(acb_mat_t B, const acb_mat_t A, long c, long prec) + void acb_mat_scalar_div_si(acb_mat_t B, const acb_mat_t A, long c, long prec) + void acb_mat_scalar_addmul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec) + void acb_mat_scalar_mul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec) + void acb_mat_scalar_div_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec) + void acb_mat_scalar_addmul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec) + void acb_mat_scalar_mul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec) + void acb_mat_scalar_div_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec) + + int acb_mat_lu(long * P, acb_mat_t LU, const acb_mat_t A, long prec) + void acb_mat_solve_lu_precomp(acb_mat_t X, const long * perm, const acb_mat_t A, const acb_mat_t B, long prec) + int acb_mat_solve(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) + int acb_mat_solve_lu(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) + int acb_mat_solve_precond(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) + int acb_mat_inv(acb_mat_t X, const acb_mat_t A, long prec) + void acb_mat_det(acb_t det, const acb_mat_t A, long prec) + + void acb_mat_exp(acb_mat_t B, const acb_mat_t A, long prec) + + void _acb_mat_charpoly(acb_ptr cp, const acb_mat_t mat, long prec) + void acb_mat_charpoly(acb_poly_t cp, const acb_mat_t mat, long prec) + + + void acb_mat_conjugate(acb_mat_t mat1, const acb_mat_t mat2) + void acb_mat_transpose(acb_mat_t B, const acb_mat_t A) + void acb_mat_trace(acb_t trace, const acb_mat_t mat, long prec) + void acb_mat_get_mid(acb_mat_t B, const acb_mat_t A) + + void acb_mat_dft(acb_mat_t res, int kind, long prec) + + void acb_mat_frobenius_norm(arb_t res, const acb_mat_t A, long prec) + + int acb_mat_eq(const acb_mat_t mat1, const acb_mat_t mat2) + int acb_mat_ne(const acb_mat_t mat1, const acb_mat_t mat2) + int acb_mat_equal(const acb_mat_t mat1, const acb_mat_t mat2) + + int acb_mat_approx_solve(acb_mat_t X, const acb_mat_t A, const acb_mat_t B, long prec) + + void acb_mat_randtest_eig(acb_mat_t A, flint_rand_t state, acb_srcptr E, long prec) + int acb_mat_approx_eig_qr(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, const mag_t tol, long maxiter, long prec) + void acb_mat_eig_global_enclosure(mag_t eps, const acb_mat_t A, acb_srcptr E, const acb_mat_t R, long prec) + + int acb_mat_eig_simple_rump(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) + int acb_mat_eig_simple_vdhoeven_mourrain(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) + int acb_mat_eig_simple(acb_ptr E, acb_mat_t L, acb_mat_t R, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) + + int acb_mat_eig_multiple_rump(acb_ptr E, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) + int acb_mat_eig_multiple(acb_ptr E, const acb_mat_t A, acb_srcptr E_approx, const acb_mat_t R_approx, long prec) diff --git a/src/flint/flintlib/acb_modular.pxd b/src/flint/flintlib/acb_modular.pxd new file mode 100644 index 00000000..4361e164 --- /dev/null +++ b/src/flint/flintlib/acb_modular.pxd @@ -0,0 +1,19 @@ +from flint.flintlib.acb cimport acb_t, acb_ptr +from flint.flintlib.acb_poly cimport acb_poly_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t + +cdef extern from "acb_modular.h": + void acb_modular_theta(acb_t theta1, acb_t theta2, acb_t theta3, acb_t theta4, const acb_t z, const acb_t tau, long prec) + void acb_modular_theta_jet(acb_ptr theta1, acb_ptr theta2, acb_ptr theta3, acb_ptr theta4, const acb_t z, const acb_t tau, long len, long prec) + void acb_modular_theta_series(acb_poly_t theta1, acb_poly_t theta2, acb_poly_t theta3, acb_poly_t theta4, const acb_poly_t z, const acb_t tau, long len, long prec) + void acb_modular_eta(acb_t r, const acb_t tau, long prec) + void acb_modular_j(acb_t r, const acb_t tau, long prec) + void acb_modular_lambda(acb_t r, const acb_t tau, long prec) + void acb_modular_delta(acb_t r, const acb_t tau, long prec) + void acb_modular_eisenstein(acb_ptr r, const acb_t tau, long len, long prec) + void acb_modular_elliptic_p(acb_t wp, const acb_t z, const acb_t tau, long prec) + void acb_modular_elliptic_p_zpx(acb_ptr wp, const acb_t z, const acb_t tau, long len, long prec) + void acb_modular_elliptic_k(acb_t w, const acb_t m, long prec) + void acb_modular_elliptic_k_cpx(acb_ptr w, const acb_t m, long len, long prec) + void acb_modular_elliptic_e(acb_t w, const acb_t m, long prec) + void acb_modular_hilbert_class_poly(fmpz_poly_t res, long D) diff --git a/src/flint/flintlib/acb_poly.pxd b/src/flint/flintlib/acb_poly.pxd new file mode 100644 index 00000000..137d23a3 --- /dev/null +++ b/src/flint/flintlib/acb_poly.pxd @@ -0,0 +1,212 @@ +from flint._flint cimport flint_rand_t, ulong +from flint.flintlib.acb cimport acb_ptr, acb_t, acb_srcptr +from flint.flintlib.arb_poly cimport arb_poly_t +from flint.flintlib.fmpq_poly cimport fmpq_poly_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t +from flint.flintlib.mag cimport mag_t +from flint.flintlib.fmpz cimport fmpz_t + +cdef extern from "acb_poly.h": + ctypedef struct acb_poly_struct: + acb_ptr coeffs + long length + long alloc + + ctypedef acb_poly_struct acb_poly_t[1] + + void acb_poly_init(acb_poly_t poly) + void acb_poly_init2(acb_poly_t poly, long len) + void acb_poly_clear(acb_poly_t poly) + void acb_poly_fit_length(acb_poly_t poly, long len) + void _acb_poly_set_length(acb_poly_t poly, long len) + void _acb_poly_normalise(acb_poly_t poly) + void acb_poly_swap(acb_poly_t poly1, acb_poly_t poly2) + long acb_poly_length(const acb_poly_t poly) + long acb_poly_degree(const acb_poly_t poly) + void acb_poly_zero(acb_poly_t poly) + void acb_poly_one(acb_poly_t poly) + void acb_poly_set_coeff_si(acb_poly_t poly, long n, long x) + void acb_poly_set_coeff_acb(acb_poly_t poly, long n, const acb_t x) + void acb_poly_get_coeff_acb(acb_t x, const acb_poly_t poly, long n) + acb_ptr acb_poly_get_coeff_ptr(arb_poly_t poly, long n) + void _acb_poly_shift_right(acb_ptr res, acb_srcptr poly, long len, long n) + void acb_poly_shift_right(acb_poly_t res, const acb_poly_t poly, long n) + void _acb_poly_shift_left(acb_ptr res, acb_srcptr poly, long len, long n) + void acb_poly_shift_left(acb_poly_t res, const acb_poly_t poly, long n) + void acb_poly_truncate(acb_poly_t poly, long newlen) + void acb_poly_printd(const acb_poly_t poly, long digits) + void _acb_poly_evaluate_horner(acb_t res, acb_srcptr f, long len, const acb_t a, long prec) + void acb_poly_evaluate_horner(acb_t res, const acb_poly_t f, const acb_t a, long prec) + void _acb_poly_evaluate_rectangular(acb_t y, acb_srcptr poly, long len, const acb_t x, long prec) + void acb_poly_evaluate_rectangular(acb_t res, const acb_poly_t f, const acb_t a, long prec) + void _acb_poly_evaluate(acb_t res, acb_srcptr f, long len, const acb_t a, long prec) + void acb_poly_evaluate(acb_t res, const acb_poly_t f, const acb_t a, long prec) + void _acb_poly_evaluate2_horner(acb_t y, acb_t z, acb_srcptr f, long len, const acb_t x, long prec) + void acb_poly_evaluate2_horner(acb_t y, acb_t z, const acb_poly_t f, const acb_t x, long prec) + void _acb_poly_evaluate2_rectangular(acb_t y, acb_t z, acb_srcptr f, long len, const acb_t x, long prec) + void acb_poly_evaluate2_rectangular(acb_t y, acb_t z, const acb_poly_t f, const acb_t x, long prec) + void _acb_poly_evaluate2(acb_t y, acb_t z, acb_srcptr f, long len, const acb_t x, long prec) + void acb_poly_evaluate2(acb_t y, acb_t z, const acb_poly_t f, const acb_t x, long prec) + void _acb_poly_derivative(acb_ptr res, acb_srcptr poly, long len, long prec) + void acb_poly_derivative(acb_poly_t res, const acb_poly_t poly, long prec) + void _acb_poly_integral(acb_ptr res, acb_srcptr poly, long len, long prec) + void acb_poly_integral(acb_poly_t res, const acb_poly_t poly, long prec) + void acb_poly_set(acb_poly_t dest, const acb_poly_t src) + void acb_poly_set_round(acb_poly_t dest, const acb_poly_t src, long prec) + void acb_poly_set_arb_poly(acb_poly_t poly, const arb_poly_t re) + void acb_poly_set2_arb_poly(acb_poly_t poly, const arb_poly_t re, const arb_poly_t im) + void acb_poly_set_fmpq_poly(acb_poly_t poly, const fmpq_poly_t re, long prec) + void acb_poly_set2_fmpq_poly(acb_poly_t poly, const fmpq_poly_t re, const fmpq_poly_t im, long prec) + void acb_poly_set_fmpz_poly(acb_poly_t poly, const fmpz_poly_t src, long prec) + void acb_poly_set_acb(acb_poly_t poly, const acb_t c) + void acb_poly_set_si(acb_poly_t poly, long c) + void acb_poly_randtest(acb_poly_t poly, flint_rand_t state, long len, long prec, long mag_bits) + int acb_poly_equal(const acb_poly_t A, const acb_poly_t B) + int acb_poly_contains_fmpz_poly(const acb_poly_t poly1, const fmpz_poly_t poly2) + int acb_poly_contains_fmpq_poly(const acb_poly_t poly1, const fmpq_poly_t poly2) + int _acb_poly_overlaps(acb_srcptr poly1, long len1, acb_srcptr poly2, long len2) + int acb_poly_overlaps(const acb_poly_t poly1, const acb_poly_t poly2) + int acb_poly_contains(const acb_poly_t poly1, const acb_poly_t poly2) + void _acb_poly_add(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) + void acb_poly_add(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) + void _acb_poly_sub(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) + void acb_poly_sub(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) + void acb_poly_neg(acb_poly_t res, const acb_poly_t poly) + void acb_poly_scalar_mul_2exp_si(acb_poly_t res, const acb_poly_t poly, long c) + void acb_poly_mullow_classical(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_mullow_classical(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void _acb_poly_mullow_transpose(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void acb_poly_mullow_transpose(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_mullow_transpose_gauss(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void acb_poly_mullow_transpose_gauss(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_mullow(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void acb_poly_mullow(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_mul(acb_ptr C, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) + void acb_poly_mul(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) + void _acb_poly_inv_series(acb_ptr Qinv, acb_srcptr Q, long Qlen, long len, long prec) + void acb_poly_inv_series(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) + void _acb_poly_div_series(acb_ptr Q, acb_srcptr A, long Alen, acb_srcptr B, long Blen, long n, long prec) + void acb_poly_div_series(acb_poly_t Q, const acb_poly_t A, const acb_poly_t B, long n, long prec) + void _acb_poly_reverse(acb_ptr res, acb_srcptr poly, long len, long n) + void _acb_poly_div(acb_ptr Q, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) + void _acb_poly_divrem(acb_ptr Q, acb_ptr R, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) + void _acb_poly_rem(acb_ptr R, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) + int acb_poly_divrem(acb_poly_t Q, acb_poly_t R, const acb_poly_t A, const acb_poly_t B, long prec) + void _acb_poly_div_root(acb_ptr Q, acb_t R, acb_srcptr A, long len, const acb_t c, long prec) + void _acb_poly_compose(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) + void acb_poly_compose(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) + void _acb_poly_compose_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) + void acb_poly_compose_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) + void _acb_poly_compose_divconquer(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) + void acb_poly_compose_divconquer(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) + void _acb_poly_compose_series_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void acb_poly_compose_series_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_compose_series_brent_kung(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void acb_poly_compose_series_brent_kung(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_compose_series(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void acb_poly_compose_series(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_revert_series_lagrange(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) + void acb_poly_revert_series_lagrange(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) + void _acb_poly_revert_series_newton(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) + void acb_poly_revert_series_newton(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) + void _acb_poly_revert_series_lagrange_fast(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) + void acb_poly_revert_series_lagrange_fast(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) + void _acb_poly_revert_series(acb_ptr Qinv, acb_srcptr Q, long Qlen, long n, long prec) + void acb_poly_revert_series(acb_poly_t Qinv, const acb_poly_t Q, long n, long prec) + void _acb_poly_evaluate_vec_fast_precomp(acb_ptr vs, acb_srcptr poly, long plen, acb_ptr * tree, long len, long prec) + void _acb_poly_evaluate_vec_fast(acb_ptr ys, acb_srcptr poly, long plen, acb_srcptr xs, long n, long prec) + void acb_poly_evaluate_vec_fast(acb_ptr ys, const acb_poly_t poly, acb_srcptr xs, long n, long prec) + void _acb_poly_evaluate_vec_iter(acb_ptr ys, acb_srcptr poly, long plen, acb_srcptr xs, long n, long prec) + void acb_poly_evaluate_vec_iter(acb_ptr ys, const acb_poly_t poly, acb_srcptr xs, long n, long prec) + void _acb_poly_interpolate_barycentric(acb_ptr poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) + void acb_poly_interpolate_barycentric(acb_poly_t poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) + void _acb_poly_interpolation_weights(acb_ptr w, acb_ptr * tree, long len, long prec) + void _acb_poly_interpolate_fast_precomp(acb_ptr poly, acb_srcptr ys, acb_ptr * tree, acb_srcptr weights, long len, long prec) + void _acb_poly_interpolate_fast(acb_ptr poly, acb_srcptr xs, acb_srcptr ys, long len, long prec) + void acb_poly_interpolate_fast(acb_poly_t poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) + void _acb_poly_interpolate_newton(acb_ptr poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) + void acb_poly_interpolate_newton(acb_poly_t poly, acb_srcptr xs, acb_srcptr ys, long n, long prec) + void _acb_poly_product_roots(acb_ptr poly, acb_srcptr xs, long n, long prec) + void acb_poly_product_roots(acb_poly_t poly, acb_srcptr xs, long n, long prec) + acb_ptr * _acb_poly_tree_alloc(long len) + void _acb_poly_tree_free(acb_ptr * tree, long len) + void _acb_poly_tree_build(acb_ptr * tree, acb_srcptr roots, long len, long prec) + void _acb_poly_root_inclusion(acb_t r, const acb_t m, acb_srcptr poly, acb_srcptr polyder, long len, long prec) + long _acb_poly_validate_roots(acb_ptr roots, acb_srcptr poly, long len, long prec) + void _acb_poly_refine_roots_durand_kerner(acb_ptr roots, acb_srcptr poly, long len, long prec) + long _acb_poly_find_roots(acb_ptr roots, acb_srcptr poly, acb_srcptr initial, long len, long maxiter, long prec) + long acb_poly_find_roots(acb_ptr roots, const acb_poly_t poly, acb_srcptr initial, long maxiter, long prec) + void _acb_poly_pow_ui_trunc_binexp(acb_ptr res, acb_srcptr f, long flen, ulong exp, long len, long prec) + void acb_poly_pow_ui_trunc_binexp(acb_poly_t res, const acb_poly_t poly, ulong exp, long len, long prec) + void _acb_poly_pow_ui(acb_ptr res, acb_srcptr f, long flen, ulong exp, long prec) + void acb_poly_pow_ui(acb_poly_t res, const acb_poly_t poly, ulong exp, long prec) + void _acb_poly_rsqrt_series(acb_ptr g, acb_srcptr h, long hlen, long len, long prec) + void acb_poly_rsqrt_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + void _acb_poly_sqrt_series(acb_ptr g, acb_srcptr h, long hlen, long len, long prec) + void acb_poly_sqrt_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + void _acb_poly_log_series(acb_ptr res, acb_srcptr f, long flen, long n, long prec) + void acb_poly_log_series(acb_poly_t res, const acb_poly_t f, long n, long prec) + void _acb_poly_atan_series(acb_ptr res, acb_srcptr f, long flen, long n, long prec) + void acb_poly_atan_series(acb_poly_t res, const acb_poly_t f, long n, long prec) + void _acb_poly_exp_series_basecase(acb_ptr f, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_exp_series_basecase(acb_poly_t f, const acb_poly_t h, long n, long prec) + void _acb_poly_exp_series(acb_ptr f, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_exp_series(acb_poly_t f, const acb_poly_t h, long n, long prec) + void _acb_poly_sin_cos_series_basecase(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_sin_cos_series_basecase(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) + void _acb_poly_sin_cos_series_tangent(acb_ptr s, acb_ptr c, const acb_srcptr h, long hlen, long len, long prec) + void acb_poly_sin_cos_series_tangent(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) + void _acb_poly_sin_cos_series(acb_ptr s, acb_ptr c, const acb_srcptr h, long hlen, long len, long prec) + void acb_poly_sin_cos_series(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) + void _acb_poly_sin_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_sin_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + void _acb_poly_cos_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_cos_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + void _acb_poly_tan_series(acb_ptr g, acb_srcptr h, long hlen, long len, long prec) + void acb_poly_tan_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + void _acb_poly_gamma_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) + void acb_poly_gamma_series(acb_poly_t res, const acb_poly_t f, long n, long prec) + void _acb_poly_rgamma_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) + void acb_poly_rgamma_series(acb_poly_t res, const acb_poly_t f, long n, long prec) + void _acb_poly_lgamma_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) + void acb_poly_lgamma_series(acb_poly_t res, const acb_poly_t f, long n, long prec) + void _acb_poly_rising_ui_series(acb_ptr res, acb_srcptr f, long flen, ulong r, long trunc, long prec) + void acb_poly_rising_ui_series(acb_poly_t res, const acb_poly_t f, ulong r, long trunc, long prec) + void _acb_poly_zeta_series(acb_ptr res, acb_srcptr h, long hlen, const acb_t a, int deflate, long len, long prec) + void acb_poly_zeta_series(acb_poly_t res, const acb_poly_t f, const acb_t a, int deflate, long n, long prec) + void _acb_poly_polylog_cpx_zeta(acb_ptr w, const acb_t s, const acb_t z, long len, long prec) + void _acb_poly_polylog_cpx_small(acb_ptr w, const acb_t s, const acb_t z, long len, long prec) + void _acb_poly_polylog_cpx(acb_ptr w, const acb_t s, const acb_t z, long len, long prec) + void _acb_poly_polylog_series(acb_ptr res, acb_srcptr s, long slen, const acb_t z, long len, long prec) + void acb_poly_polylog_series(acb_poly_t res, const acb_poly_t s, const acb_t z, long n, long prec) + + void _acb_poly_pow_series(acb_ptr h, acb_srcptr f, long flen, acb_srcptr g, long glen, long len, long prec) + void acb_poly_pow_series(acb_poly_t h, const acb_poly_t f, const acb_poly_t g, long len, long prec) + void _acb_poly_pow_acb_series(acb_ptr h, acb_srcptr f, long flen, const acb_t g, long len, long prec) + void acb_poly_pow_acb_series(acb_poly_t h, const acb_poly_t f, const acb_t g, long len, long prec) + + void _acb_poly_agm1_series(acb_ptr res, acb_srcptr z, long zlen, long len, long prec) + void acb_poly_agm1_series(acb_poly_t res, const acb_poly_t z, long n, long prec) + + void _acb_poly_elliptic_k_series(acb_ptr res, acb_srcptr z, long zlen, long len, long prec) + void acb_poly_elliptic_k_series(acb_poly_t res, const acb_poly_t z, long n, long prec) + void _acb_poly_elliptic_p_series(acb_ptr res, acb_srcptr z, long zlen, const acb_t tau, long len, long prec) + void acb_poly_elliptic_p_series(acb_poly_t res, const acb_poly_t z, const acb_t tau, long n, long prec) + + void _acb_poly_erf_series(acb_ptr res, acb_srcptr h, long hlen, long len, long prec) + void acb_poly_erf_series(acb_poly_t res, const acb_poly_t h, long n, long prec) + int acb_poly_get_unique_fmpz_poly(fmpz_poly_t res, const acb_poly_t src) + + void _acb_poly_sin_cos_pi_series(acb_ptr s, acb_ptr c, const acb_srcptr h, long hlen, long len, long prec) + void acb_poly_sin_cos_pi_series(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) + void _acb_poly_sin_pi_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_sin_pi_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + void _acb_poly_cos_pi_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_cos_pi_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + + void _acb_poly_cot_pi_series(acb_ptr g, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_cot_pi_series(acb_poly_t g, const acb_poly_t h, long n, long prec) + + void acb_poly_root_bound_fujiwara(mag_t bound, acb_poly_t poly) + + void acb_poly_lambertw_series(acb_poly_t res, const acb_poly_t z, const fmpz_t k, int flags, long len, long prec) diff --git a/src/flint/flintlib/arb.pxd b/src/flint/flintlib/arb.pxd new file mode 100644 index 00000000..c846592c --- /dev/null +++ b/src/flint/flintlib/arb.pxd @@ -0,0 +1,296 @@ +from flint._flint cimport ulong, slong, flint_rand_t +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.fmpq cimport fmpq_t +from flint.flintlib.arf cimport arf_struct, arf_ptr, arf_t +from flint.flintlib.mag cimport mag_struct, mag_ptr, mag_t + +cdef extern from "arb.h": + ctypedef struct arb_struct: + arf_struct mid + mag_struct rad + + ctypedef arb_struct * arb_ptr + ctypedef const arb_struct * arb_srcptr + ctypedef arb_struct arb_t[1] + + arf_ptr arb_midref(const arb_t x) + mag_ptr arb_radref(const arb_t x) + + void arb_init(arb_t x) + void arb_clear(arb_t x) + + void arb_init(arb_t x) + void arb_clear(arb_t x) + int arb_is_exact(const arb_t x) + int arb_equal(const arb_t x, const arb_t y) + int arb_eq(const arb_t x, const arb_t y) + int arb_ne(const arb_t x, const arb_t y) + int arb_lt(const arb_t x, const arb_t y) + int arb_le(const arb_t x, const arb_t y) + int arb_gt(const arb_t x, const arb_t y) + int arb_ge(const arb_t x, const arb_t y) + void arb_zero(arb_t x) + int arb_is_zero(const arb_t x) + void arb_pos_inf(arb_t x) + void arb_neg_inf(arb_t x) + void arb_zero_pm_inf(arb_t x) + void arb_indeterminate(arb_t x) + int arb_is_finite(const arb_t x) + void arb_set(arb_t x, const arb_t y) + void arb_swap(arb_t x, arb_t y) + void arb_set_round(arb_t z, const arb_t x, long prec) + void arb_trim(arb_t y, const arb_t x) + void arb_neg(arb_t x, const arb_t y) + void arb_neg_round(arb_t x, const arb_t y, long prec) + void arb_abs(arb_t x, const arb_t y) + void arb_sgn(arb_t x, const arb_t y) + void arb_set_arf(arb_t x, const arf_t y) + void arb_set_si(arb_t x, long y) + void arb_set_ui(arb_t x, ulong y) + void arb_set_fmpz(arb_t x, const fmpz_t y) + void arb_set_fmpz_2exp(arb_t x, const fmpz_t y, const fmpz_t exp) + void arb_set_round_fmpz_2exp(arb_t y, const fmpz_t x, const fmpz_t exp, long prec) + void arb_set_round_fmpz(arb_t y, const fmpz_t x, long prec) + int arb_is_one(const arb_t f) + void arb_one(arb_t f) + void arb_print(const arb_t x) + void arb_printd(const arb_t x, long digits) + void arb_mul_2exp_si(arb_t y, const arb_t x, long e) + void arb_mul_2exp_fmpz(arb_t y, const arb_t x, const fmpz_t e) + int arb_is_int(const arb_t x) + int arb_contains_zero(const arb_t x) + int arb_is_nonzero(const arb_t x) + int arb_is_positive(const arb_t x) + int arb_is_nonnegative(const arb_t x) + int arb_is_negative(const arb_t x) + int arb_is_nonpositive(const arb_t x) + int arb_contains_negative(const arb_t x) + int arb_contains_nonpositive(const arb_t x) + int arb_contains_positive(const arb_t x) + int arb_contains_nonnegative(const arb_t x) + int arb_contains_int(const arb_t x) + void arb_get_mag_lower(mag_t z, const arb_t x) + void arb_get_mag_lower_nonnegative(mag_t z, const arb_t x) + void arb_get_mag(mag_t z, const arb_t x) + void arb_get_abs_ubound_arf(arf_t u, const arb_t x, long prec) + void arb_get_abs_lbound_arf(arf_t u, const arb_t x, long prec) + void arb_get_ubound_arf(arf_t u, const arb_t z, long prec) + void arb_get_lbound_arf(arf_t u, const arb_t z, long prec) + void arb_nonnegative_part(arb_t u, const arb_t x) + slong arb_rel_error_bits(const arb_t x) + slong arb_rel_accuracy_bits(const arb_t x) + long arb_bits(const arb_t x) + void arb_randtest_exact(arb_t x, flint_rand_t state, long prec, long mag_bits) + void arb_randtest_wide(arb_t x, flint_rand_t state, long prec, long mag_bits) + void arb_randtest_precise(arb_t x, flint_rand_t state, long prec, long mag_bits) + void arb_randtest(arb_t x, flint_rand_t state, long prec, long mag_bits) + void arb_randtest_special(arb_t x, flint_rand_t state, long prec, long mag_bits) + void arb_add_error_arf(arb_t x, const arf_t err) + void arb_add_error_2exp_si(arb_t x, long err) + void arb_add_error_2exp_fmpz(arb_t x, const fmpz_t err) + void arb_add_error(arb_t x, const arb_t error) + void arb_add_error_mag(arb_t x, const mag_t err) + int arb_contains_arf(const arb_t x, const arf_t y) + int arb_contains_fmpq(const arb_t x, const fmpq_t y) + int arb_contains_fmpz(const arb_t x, const fmpz_t y) + int arb_contains_si(const arb_t x, long y) + int arb_overlaps(const arb_t x, const arb_t y) + int arb_contains(const arb_t x, const arb_t y) + int arb_contains_interior(const arb_t x, const arb_t y) + void arb_get_interval_fmpz_2exp(fmpz_t a, fmpz_t b, fmpz_t exp, const arb_t x) + int arb_get_unique_fmpz(fmpz_t z, const arb_t x) + void arb_get_fmpz_mid_rad_10exp(fmpz_t mid, fmpz_t rad, fmpz_t exp, const arb_t x, long n) + + int arb_set_str(arb_t res, const char * inp, long prec) + + void arb_floor(arb_t z, const arb_t x, long prec) + void arb_ceil(arb_t z, const arb_t x, long prec) + void arb_set_interval_arf(arb_t x, const arf_t a, const arf_t b, long prec) + void arb_get_interval_arf(arf_t a, arf_t b, const arb_t x, long prec) + void arb_union(arb_t z, const arb_t x, const arb_t y, long prec) + int arb_intersection(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_min(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_max(arb_t z, const arb_t x, const arb_t y, long prec) + + void arb_get_rand_fmpq(fmpq_t q, flint_rand_t state, const arb_t x, long bits) + + void arb_add(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_add_arf(arb_t z, const arb_t x, const arf_t y, long prec) + void arb_add_ui(arb_t z, const arb_t x, ulong y, long prec) + void arb_add_si(arb_t z, const arb_t x, long y, long prec) + void arb_add_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) + void arb_add_fmpz_2exp(arb_t z, const arb_t x, const fmpz_t man, const fmpz_t exp, long prec) + + void arb_sub(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_sub_arf(arb_t z, const arb_t x, const arf_t y, long prec) + void arb_sub_ui(arb_t z, const arb_t x, ulong y, long prec) + void arb_sub_si(arb_t z, const arb_t x, long y, long prec) + void arb_sub_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) + + void arb_mul(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_mul_arf(arb_t z, const arb_t x, const arf_t y, long prec) + void arb_mul_si(arb_t z, const arb_t x, long y, long prec) + void arb_mul_ui(arb_t z, const arb_t x, ulong y, long prec) + void arb_mul_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) + + void arb_addmul(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_addmul_arf(arb_t z, const arb_t x, const arf_t y, long prec) + void arb_addmul_si(arb_t z, const arb_t x, long y, long prec) + void arb_addmul_ui(arb_t z, const arb_t x, ulong y, long prec) + void arb_addmul_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) + + void arb_submul(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_submul_arf(arb_t z, const arb_t x, const arf_t y, long prec) + void arb_submul_si(arb_t z, const arb_t x, long y, long prec) + void arb_submul_ui(arb_t z, const arb_t x, ulong y, long prec) + void arb_submul_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) + + void arb_div(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_div_arf(arb_t z, const arb_t x, const arf_t y, long prec) + void arb_div_si(arb_t z, const arb_t x, long y, long prec) + void arb_div_ui(arb_t z, const arb_t x, ulong y, long prec) + void arb_div_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec) + void arb_fmpz_div_fmpz(arb_t z, const fmpz_t x, const fmpz_t y, long prec) + void arb_ui_div(arb_t z, ulong x, const arb_t y, long prec) + + void arb_inv(arb_t y, const arb_t x, long prec) + void arb_set_fmpq(arb_t y, const fmpq_t x, long prec) + + void arb_sqrt(arb_t z, const arb_t x, long prec) + void arb_sqrt_arf(arb_t z, const arf_t x, long prec) + void arb_sqrt_fmpz(arb_t z, const fmpz_t x, long prec) + void arb_sqrt_ui(arb_t z, ulong x, long prec) + + void arb_sqrtpos(arb_t z, const arb_t x, long prec) + void arb_hypot(arb_t z, const arb_t x, const arb_t y, long prec) + + void arb_rsqrt(arb_t z, const arb_t x, long prec) + void arb_rsqrt_ui(arb_t z, ulong x, long prec) + + void arb_pow_fmpz_binexp(arb_t y, const arb_t b, const fmpz_t e, long prec) + void arb_pow_fmpz(arb_t y, const arb_t b, const fmpz_t e, long prec) + void arb_pow_ui(arb_t y, const arb_t b, ulong e, long prec) + void arb_ui_pow_ui(arb_t y, ulong b, ulong e, long prec) + void arb_si_pow_ui(arb_t y, long b, ulong e, long prec) + void arb_pow_fmpq(arb_t y, const arb_t x, const fmpq_t a, long prec) + + void arb_div_2expm1_ui(arb_t z, const arb_t x, ulong n, long prec) + void arb_pow(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_root(arb_t z, const arb_t x, ulong k, long prec) + void arb_log(arb_t z, const arb_t x, long prec) + void arb_log_arf(arb_t z, const arf_t x, long prec) + void arb_log_ui(arb_t z, ulong x, long prec) + void arb_log_fmpz(arb_t z, const fmpz_t x, long prec) + void arb_log1p(arb_t z, const arb_t x, long prec) + void arb_exp(arb_t z, const arb_t x, long prec) + void arb_expm1(arb_t z, const arb_t x, long prec) + void arb_sin(arb_t s, const arb_t x, long prec) + void arb_cos(arb_t c, const arb_t x, long prec) + void arb_sin_cos(arb_t s, arb_t c, const arb_t x, long prec) + void arb_sin_pi(arb_t s, const arb_t x, long prec) + void arb_cos_pi(arb_t c, const arb_t x, long prec) + void arb_sin_cos_pi(arb_t s, arb_t c, const arb_t x, long prec) + void arb_tan(arb_t y, const arb_t x, long prec) + void arb_cot(arb_t y, const arb_t x, long prec) + void arb_sec(arb_t y, const arb_t x, long prec) + void arb_csc(arb_t y, const arb_t x, long prec) + void arb_tan_pi(arb_t y, const arb_t x, long prec) + void arb_cot_pi(arb_t y, const arb_t x, long prec) + void arb_sin_cos_pi_fmpq(arb_t s, arb_t c, const fmpq_t x, long prec) + void arb_sin_pi_fmpq(arb_t s, const fmpq_t x, long prec) + void arb_cos_pi_fmpq(arb_t c, const fmpq_t x, long prec) + void arb_sinc(arb_t s, const arb_t x, long prec) + void arb_sinc_pi(arb_t s, const arb_t x, long prec) + void arb_sinh(arb_t z, const arb_t x, long prec) + void arb_cosh(arb_t z, const arb_t x, long prec) + void arb_sinh_cosh(arb_t s, arb_t c, const arb_t x, long prec) + void arb_tanh(arb_t y, const arb_t x, long prec) + void arb_coth(arb_t y, const arb_t x, long prec) + void arb_sech(arb_t y, const arb_t x, long prec) + void arb_csch(arb_t y, const arb_t x, long prec) + void arb_atan_arf(arb_t z, const arf_t x, long prec) + void arb_atan(arb_t z, const arb_t x, long prec) + void arb_atan2(arb_t z, const arb_t b, const arb_t a, long prec) + void arb_asin(arb_t z, const arb_t x, long prec) + void arb_acos(arb_t z, const arb_t x, long prec) + void arb_atanh(arb_t z, const arb_t x, long prec) + void arb_asinh(arb_t z, const arb_t x, long prec) + void arb_acosh(arb_t z, const arb_t x, long prec) + void arb_fac_ui(arb_t z, ulong n, long prec) + void arb_bin_ui(arb_t z, const arb_t n, ulong k, long prec) + void arb_bin_uiui(arb_t z, ulong n, ulong k, long prec) + void arb_fib_fmpz(arb_t z, const fmpz_t n, long prec) + void arb_fib_ui(arb_t z, ulong n, long prec) + void arb_const_pi(arb_t z, long prec) + void arb_const_sqrt_pi(arb_t z, long prec) + void arb_const_log_sqrt2pi(arb_t z, long prec) + void arb_const_log2(arb_t z, long prec) + void arb_const_log10(arb_t z, long prec) + void arb_const_euler(arb_t z, long prec) + void arb_const_catalan(arb_t z, long prec) + void arb_const_e(arb_t z, long prec) + void arb_const_khinchin(arb_t z, long prec) + void arb_const_glaisher(arb_t z, long prec) + void arb_agm(arb_t z, const arb_t x, const arb_t y, long prec) + void arb_lgamma(arb_t z, const arb_t x, long prec) + void arb_rgamma(arb_t z, const arb_t x, long prec) + void arb_gamma(arb_t z, const arb_t x, long prec) + void arb_gamma_fmpq(arb_t z, const fmpq_t x, long prec) + void arb_gamma_fmpz(arb_t z, const fmpz_t x, long prec) + void arb_digamma(arb_t y, const arb_t x, long prec) + void arb_zeta(arb_t z, const arb_t s, long prec) + void arb_zeta_ui(arb_t z, ulong n, long prec) + void arb_bernoulli_ui(arb_t z, ulong n, long prec) + void arb_bernoulli_fmpz(arb_t z, const fmpz_t n, long prec) + void arb_bernoulli_poly_ui(arb_t z, ulong n, const arb_t x, long prec) + void arb_hurwitz_zeta(arb_t z, const arb_t s, const arb_t a, long prec) + + void arb_bell_fmpz(arb_t z, const fmpz_t n, long prec) + + void arb_partitions_fmpz(arb_t z, const fmpz_t n, long prec) + void arb_partitions_ui(arb_t z, ulong n, long prec) + + void arb_lambertw(arb_t z, const arb_t x, int flags, long prec) + + + void arb_rising_ui_bs(arb_t y, const arb_t x, ulong n, long prec) + void arb_rising_ui_rs(arb_t y, const arb_t x, ulong n, ulong m, long prec) + void arb_rising_ui_rec(arb_t y, const arb_t x, ulong n, long prec) + void arb_rising_ui(arb_t z, const arb_t x, ulong n, long prec) + void arb_rising_fmpq_ui(arb_t y, const fmpq_t x, ulong n, long prec) + void arb_rising(arb_t y, const arb_t x, const arb_t n, long prec) + + void arb_rising2_ui_rs(arb_t u, arb_t v, const arb_t x, ulong n, ulong m, long prec) + void arb_rising2_ui_bs(arb_t u, arb_t v, const arb_t x, ulong n, long prec) + void arb_rising2_ui(arb_t u, arb_t v, const arb_t x, ulong n, long prec) + + void arb_log_ui_from_prev(arb_t s, ulong k, arb_t log_prev, ulong prev, long prec) + + void arb_const_apery(arb_t s, long prec) + + void arb_zeta_ui_asymp(arb_t x, ulong s, long prec) + void arb_zeta_ui_borwein_bsplit(arb_t x, ulong s, long prec) + void arb_zeta_ui_euler_product(arb_t z, ulong s, long prec) + void arb_zeta_ui_bernoulli(arb_t x, ulong n, long prec) + void arb_zeta_ui_vec_borwein(arb_ptr z, ulong start, long num, ulong step, long prec) + void arb_zeta_ui(arb_t x, ulong n, long prec) + void arb_zeta_ui_vec_even(arb_ptr x, ulong start, long num, long prec) + void arb_zeta_ui_vec_odd(arb_ptr x, ulong start, long num, long prec) + void arb_zeta_ui_vec(arb_ptr x, ulong start, long num, long prec) + void arb_bernoulli_ui(arb_t b, ulong n, long prec) + void arb_bernoulli_ui_zeta(arb_t b, ulong n, long prec) + + void arb_polylog(arb_t w, const arb_t s, const arb_t z, long prec) + void arb_polylog_si(arb_t w, long s, const arb_t z, long prec) + + void arb_chebyshev_t_ui(arb_t a, ulong n, const arb_t x, long prec) + void arb_chebyshev_t2_ui(arb_t a, arb_t b, ulong n, const arb_t x, long prec) + void arb_chebyshev_u_ui(arb_t a, ulong n, const arb_t x, long prec) + void arb_chebyshev_u2_ui(arb_t a, arb_t b, ulong n, const arb_t x, long prec) + + void arb_root_ui(arb_t z, const arb_t x, ulong k, long prec) + + cdef ulong ARB_STR_MORE + cdef ulong ARB_STR_NO_RADIUS + cdef ulong ARB_STR_CONDENSE + char * arb_get_str(const arb_t x, long n, ulong flags) diff --git a/src/flint/flintlib/arb_fmpz_poly.pxd b/src/flint/flintlib/arb_fmpz_poly.pxd new file mode 100644 index 00000000..60be9a79 --- /dev/null +++ b/src/flint/flintlib/arb_fmpz_poly.pxd @@ -0,0 +1,11 @@ +from flint.flintlib.arb cimport arb_t +from flint.flintlib.acb cimport acb_t, acb_ptr +from flint.flintlib.fmpz_poly cimport fmpz_poly_t +from flint._flint cimport ulong + +cdef extern from "arb_fmpz_poly.h": + void arb_fmpz_poly_evaluate_arb(arb_t res, const fmpz_poly_t poly, const arb_t x, long prec) + void arb_fmpz_poly_evaluate_acb(acb_t res, const fmpz_poly_t poly, const acb_t x, long prec) + void arb_fmpz_poly_complex_roots(acb_ptr roots, const fmpz_poly_t poly, int flags, long prec) + ulong arb_fmpz_poly_deflation(const fmpz_poly_t poly) + void arb_fmpz_poly_deflate(fmpz_poly_t res, const fmpz_poly_t poly, ulong deflation) diff --git a/src/flint/flintlib/arb_hypgeom.pxd b/src/flint/flintlib/arb_hypgeom.pxd new file mode 100644 index 00000000..bca0d1f4 --- /dev/null +++ b/src/flint/flintlib/arb_hypgeom.pxd @@ -0,0 +1,69 @@ +from flint.flintlib.arb cimport arb_t, arb_srcptr +from flint.flintlib.arb_poly cimport arb_poly_t +from flint.flintlib.fmpz cimport fmpz_t +from flint._flint cimport ulong + +cdef extern from "arb_hypgeom.h": + void arb_hypgeom_pfq(arb_t res, arb_srcptr a, long p, arb_srcptr b, long q, const arb_t z, int regularized, long prec) + void arb_hypgeom_0f1(arb_t res, const arb_t a, const arb_t z, int regularized, long prec) + void arb_hypgeom_m(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, long prec) + void arb_hypgeom_1f1(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, long prec) + void arb_hypgeom_u(arb_t res, const arb_t a, const arb_t b, const arb_t z, long prec) + void arb_hypgeom_2f1(arb_t res, const arb_t a, const arb_t b, const arb_t c, const arb_t z, int regularized, long prec) + + void arb_hypgeom_erf(arb_t res, const arb_t z, long prec) + void arb_hypgeom_erf_series(arb_poly_t g, const arb_poly_t h, long len, long prec) + void arb_hypgeom_erfc(arb_t res, const arb_t z, long prec) + void arb_hypgeom_erfc_series(arb_poly_t g, const arb_poly_t h, long len, long prec) + void arb_hypgeom_erfi(arb_t res, const arb_t z, long prec) + void arb_hypgeom_erfi_series(arb_poly_t g, const arb_poly_t h, long len, long prec) + void arb_hypgeom_fresnel(arb_t res1, arb_t res2, const arb_t z, int normalized, long prec) + void arb_hypgeom_fresnel_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, int normalized, long len, long prec) + + void arb_hypgeom_ei(arb_t res, const arb_t z, long prec) + void arb_hypgeom_si(arb_t res, const arb_t z, long prec) + void arb_hypgeom_ci(arb_t res, const arb_t z, long prec) + void arb_hypgeom_shi(arb_t res, const arb_t z, long prec) + void arb_hypgeom_chi(arb_t res, const arb_t z, long prec) + void arb_hypgeom_li(arb_t res, const arb_t z, int offset, long prec) + void arb_hypgeom_ei_series(arb_poly_t res, const arb_poly_t h, long n, long prec) + void arb_hypgeom_si_series(arb_poly_t res, const arb_poly_t h, long n, long prec) + void arb_hypgeom_ci_series(arb_poly_t res, const arb_poly_t h, long n, long prec) + void arb_hypgeom_shi_series(arb_poly_t res, const arb_poly_t h, long n, long prec) + void arb_hypgeom_chi_series(arb_poly_t res, const arb_poly_t h, long n, long prec) + void arb_hypgeom_li_series(arb_poly_t res, const arb_poly_t h, int offset, long n, long prec) + + void arb_hypgeom_bessel_j(arb_t res, const arb_t nu, const arb_t z, long prec) + void arb_hypgeom_bessel_k(arb_t res, const arb_t nu, const arb_t z, long prec) + void arb_hypgeom_bessel_i(arb_t res, const arb_t nu, const arb_t z, long prec) + void arb_hypgeom_bessel_y(arb_t res, const arb_t nu, const arb_t z, long prec) + + void arb_hypgeom_bessel_k_scaled(arb_t res, const arb_t nu, const arb_t z, long prec) + void arb_hypgeom_bessel_i_scaled(arb_t res, const arb_t nu, const arb_t z, long prec) + + void arb_hypgeom_airy(arb_t ai, arb_t aip, arb_t bi, arb_t bip, const arb_t z, long prec) + void arb_hypgeom_airy_series(arb_poly_t ai, arb_poly_t ai_prime, arb_poly_t bi, arb_poly_t bi_prime, const arb_poly_t z, long len, long prec) + void arb_hypgeom_airy_zero(arb_t ai, arb_t aip, arb_t bi, arb_t bip, const fmpz_t n, long prec) + + void arb_hypgeom_coulomb(arb_t F, arb_t G, const arb_t l, const arb_t eta, const arb_t z, long prec) + void arb_hypgeom_coulomb_series(arb_poly_t F, arb_poly_t G, const arb_t l, const arb_t eta, const arb_poly_t z, long len, long prec) + + void arb_hypgeom_expint(arb_t res, const arb_t s, const arb_t z, long prec) + void arb_hypgeom_gamma_upper(arb_t res, const arb_t s, const arb_t z, int modified, long prec) + void arb_hypgeom_gamma_lower(arb_t res, const arb_t s, const arb_t z, int modified, long prec) + void arb_hypgeom_beta_lower(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, long prec) + + void arb_hypgeom_gamma_upper_series(arb_poly_t g, const arb_t s, const arb_poly_t h, int regularized, long n, long prec) + void arb_hypgeom_gamma_lower_series(arb_poly_t g, const arb_t s, const arb_poly_t h, int regularized, long n, long prec) + void arb_hypgeom_beta_lower_series(arb_poly_t g, const arb_t s, const arb_t t, const arb_poly_t h, int regularized, long n, long prec) + + void arb_hypgeom_chebyshev_t(arb_t res, const arb_t nu, const arb_t z, long prec) + void arb_hypgeom_chebyshev_u(arb_t res, const arb_t nu, const arb_t z, long prec) + void arb_hypgeom_jacobi_p(arb_t res, const arb_t n, const arb_t a, const arb_t b, const arb_t z, long prec) + void arb_hypgeom_gegenbauer_c(arb_t res, const arb_t n, const arb_t m, const arb_t z, long prec) + void arb_hypgeom_laguerre_l(arb_t res, const arb_t n, const arb_t m, const arb_t z, long prec) + void arb_hypgeom_hermite_h(arb_t res, const arb_t nu, const arb_t z, long prec) + void arb_hypgeom_legendre_p(arb_t res, const arb_t n, const arb_t m, const arb_t z, int type, long prec) + void arb_hypgeom_legendre_q(arb_t res, const arb_t n, const arb_t m, const arb_t z, int type, long prec) + + void arb_hypgeom_legendre_p_ui_root(arb_t res, arb_t weight, ulong n, ulong k, long prec) diff --git a/src/flint/flintlib/arb_mat.pxd b/src/flint/flintlib/arb_mat.pxd new file mode 100644 index 00000000..3220a516 --- /dev/null +++ b/src/flint/flintlib/arb_mat.pxd @@ -0,0 +1,89 @@ +from flint.flintlib.arb cimport arb_ptr, arb_struct +from flint.flintlib.fmpz_mat cimport fmpz_mat_t +from flint.flintlib.fmpq_mat cimport fmpq_mat_t +from flint.flintlib.mag cimport mag_t +from flint._flint cimport ulong +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.arb cimport arb_t +from flint.flintlib.arb_poly cimport arb_poly_t + +cdef extern from "arb_mat.h": + ctypedef struct arb_mat_struct: + arb_ptr entries + long r + long c + arb_ptr * rows + + ctypedef arb_mat_struct arb_mat_t[1] + + arb_struct * arb_mat_entry(arb_mat_t mat, long i, long j) + + long arb_mat_nrows(const arb_mat_t x) + long arb_mat_ncols(const arb_mat_t x) + + void arb_mat_init(arb_mat_t mat, long r, long c) + void arb_mat_clear(arb_mat_t mat) + + void arb_mat_set(arb_mat_t dest, const arb_mat_t src) + void arb_mat_set_fmpz_mat(arb_mat_t dest, const fmpz_mat_t src) + void arb_mat_set_fmpq_mat(arb_mat_t dest, const fmpq_mat_t src, long prec) + void arb_mat_printd(const arb_mat_t mat, long digits) + int arb_mat_equal(const arb_mat_t mat1, const arb_mat_t mat2) + int arb_mat_overlaps(const arb_mat_t mat1, const arb_mat_t mat2) + int arb_mat_contains(const arb_mat_t mat1, const arb_mat_t mat2) + int arb_mat_contains_fmpq_mat(const arb_mat_t mat1, const fmpq_mat_t mat2) + int arb_mat_contains_fmpz_mat(const arb_mat_t mat1, const fmpz_mat_t mat2) + + void arb_mat_zero(arb_mat_t mat) + void arb_mat_one(arb_mat_t mat) + + void arb_mat_bound_inf_norm(mag_t b, const arb_mat_t A) + + void arb_mat_neg(arb_mat_t dest, const arb_mat_t src) + void arb_mat_add(arb_mat_t res, const arb_mat_t mat1, const arb_mat_t mat2, long prec) + void arb_mat_sub(arb_mat_t res, const arb_mat_t mat1, const arb_mat_t mat2, long prec) + void arb_mat_mul(arb_mat_t res, const arb_mat_t mat1, const arb_mat_t mat2, long prec) + void arb_mat_pow_ui(arb_mat_t B, const arb_mat_t A, ulong exp, long prec) + + void arb_mat_scalar_mul_2exp_si(arb_mat_t B, const arb_mat_t A, long c) + void arb_mat_scalar_addmul_si(arb_mat_t B, const arb_mat_t A, long c, long prec) + void arb_mat_scalar_mul_si(arb_mat_t B, const arb_mat_t A, long c, long prec) + void arb_mat_scalar_div_si(arb_mat_t B, const arb_mat_t A, long c, long prec) + void arb_mat_scalar_addmul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec) + void arb_mat_scalar_mul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec) + void arb_mat_scalar_div_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec) + void arb_mat_scalar_addmul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec) + void arb_mat_scalar_mul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec) + void arb_mat_scalar_div_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec) + + int arb_mat_lu(long * P, arb_mat_t LU, const arb_mat_t A, long prec) + void arb_mat_solve_lu_precomp(arb_mat_t X, const long * perm, const arb_mat_t A, const arb_mat_t B, long prec) + int arb_mat_solve(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) + int arb_mat_solve_lu(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) + int arb_mat_solve_precond(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) + int arb_mat_inv(arb_mat_t X, const arb_mat_t A, long prec) + void arb_mat_det(arb_t det, const arb_mat_t A, long prec) + + void arb_mat_exp(arb_mat_t B, const arb_mat_t A, long prec) + + void _arb_mat_charpoly(arb_ptr cp, const arb_mat_t mat, long prec) + void arb_mat_charpoly(arb_poly_t cp, const arb_mat_t mat, long prec) + + void arb_mat_transpose(arb_mat_t B, const arb_mat_t A) + + void arb_mat_trace(arb_t trace, const arb_mat_t mat, long prec) + void arb_mat_ones(arb_mat_t mat) + void arb_mat_hilbert(arb_mat_t mat, long prec) + void arb_mat_pascal(arb_mat_t mat, int triangular, long prec) + void arb_mat_stirling(arb_mat_t mat, int kind, long prec) + void arb_mat_dct(arb_mat_t mat, int type, long prec) + + void arb_mat_get_mid(arb_mat_t B, const arb_mat_t A) + + int arb_mat_eq(const arb_mat_t mat1, const arb_mat_t mat2) + int arb_mat_ne(const arb_mat_t mat1, const arb_mat_t mat2) + int arb_mat_equal(const arb_mat_t mat1, const arb_mat_t mat2) + + void arb_mat_frobenius_norm(arb_t res, const arb_mat_t A, long prec) + + int arb_mat_approx_solve(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec) diff --git a/src/flint/flintlib/arb_poly.pxd b/src/flint/flintlib/arb_poly.pxd new file mode 100644 index 00000000..9476d313 --- /dev/null +++ b/src/flint/flintlib/arb_poly.pxd @@ -0,0 +1,213 @@ +from flint._flint cimport flint_rand_t, ulong +from flint.flintlib.arb cimport arb_ptr, arb_t, arb_srcptr +from flint.flintlib.fmpz_poly cimport fmpz_poly_t +from flint.flintlib.fmpq_poly cimport fmpq_poly_t +from flint.flintlib.acb cimport acb_t + +cdef extern from "arb_poly.h": + ctypedef struct arb_poly_struct: + arb_ptr coeffs + long length + long alloc + + ctypedef arb_poly_struct arb_poly_t[1] + + void arb_poly_init(arb_poly_t poly) + void arb_poly_init2(arb_poly_t poly, long len) + void arb_poly_clear(arb_poly_t poly) + void arb_poly_fit_length(arb_poly_t poly, long len) + void _arb_poly_set_length(arb_poly_t poly, long len) + void _arb_poly_normalise(arb_poly_t poly) + void arb_poly_swap(arb_poly_t poly1, arb_poly_t poly2) + void arb_poly_set(arb_poly_t poly, const arb_poly_t src) + void arb_poly_set_round(arb_poly_t dest, const arb_poly_t src, long prec) + long arb_poly_length(const arb_poly_t poly) + long arb_poly_degree(const arb_poly_t poly) + void arb_poly_zero(arb_poly_t poly) + void arb_poly_one(arb_poly_t poly) + void arb_poly_set_coeff_si(arb_poly_t poly, long n, long x) + void arb_poly_set_coeff_arb(arb_poly_t poly, long n, const arb_t x) + void arb_poly_get_coeff_arb(arb_t x, const arb_poly_t poly, long n) + arb_ptr arb_poly_get_coeff_ptr(arb_poly_t poly, long n) + void _arb_poly_reverse(arb_ptr res, arb_srcptr poly, long len, long n) + void _arb_poly_shift_right(arb_ptr res, arb_srcptr poly, long len, long n) + void arb_poly_shift_right(arb_poly_t res, const arb_poly_t poly, long n) + void _arb_poly_shift_left(arb_ptr res, arb_srcptr poly, long len, long n) + void arb_poly_shift_left(arb_poly_t res, const arb_poly_t poly, long n) + void arb_poly_truncate(arb_poly_t poly, long newlen) + void arb_poly_set_fmpz_poly(arb_poly_t poly, const fmpz_poly_t src, long prec) + void arb_poly_set_fmpq_poly(arb_poly_t poly, const fmpq_poly_t src, long prec) + void arb_poly_set_arb(arb_poly_t poly, const arb_t c) + void arb_poly_set_si(arb_poly_t poly, long c) + int arb_poly_contains(const arb_poly_t poly1, const arb_poly_t poly2) + int arb_poly_contains_fmpz_poly(const arb_poly_t poly1, const fmpz_poly_t poly2) + int arb_poly_contains_fmpq_poly(const arb_poly_t poly1, const fmpq_poly_t poly2) + int arb_poly_equal(const arb_poly_t A, const arb_poly_t B) + int _arb_poly_overlaps(arb_srcptr poly1, long len1, arb_srcptr poly2, long len2) + int arb_poly_overlaps(const arb_poly_t poly1, const arb_poly_t poly2) + void arb_poly_printd(const arb_poly_t poly, long digits) + void arb_poly_randtest(arb_poly_t poly, flint_rand_t state, long len, long prec, long mag_bits) + void _arb_poly_add(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) + void arb_poly_add(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) + void _arb_poly_sub(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) + void arb_poly_sub(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) + void arb_poly_neg(arb_poly_t res, const arb_poly_t poly) + void arb_poly_scalar_mul_2exp_si(arb_poly_t res, const arb_poly_t poly, long c) + void _arb_poly_mullow(arb_ptr C, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long n, long prec) + void arb_poly_mullow(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long len, long prec) + void _arb_poly_mul(arb_ptr C, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) + void arb_poly_mul(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) + void _arb_poly_inv_series(arb_ptr Qinv, arb_srcptr Q, long Qlen, long len, long prec) + void arb_poly_inv_series(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) + void _arb_poly_div_series(arb_ptr Q, arb_srcptr A, long Alen, arb_srcptr B, long Blen, long n, long prec) + void arb_poly_div_series(arb_poly_t Q, const arb_poly_t A, const arb_poly_t B, long n, long prec) + void _arb_poly_div(arb_ptr Q, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) + void _arb_poly_divrem(arb_ptr Q, arb_ptr R, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) + void _arb_poly_rem(arb_ptr R, arb_srcptr A, long lenA, arb_srcptr B, long lenB, long prec) + int arb_poly_divrem(arb_poly_t Q, arb_poly_t R, const arb_poly_t A, const arb_poly_t B, long prec) + void _arb_poly_div_root(arb_ptr Q, arb_t R, arb_srcptr A, long len, const arb_t c, long prec) + void _arb_poly_product_roots(arb_ptr poly, arb_srcptr xs, long n, long prec) + void arb_poly_product_roots(arb_poly_t poly, arb_srcptr xs, long n, long prec) + arb_ptr * _arb_poly_tree_alloc(long len) + void _arb_poly_tree_free(arb_ptr * tree, long len) + void _arb_poly_tree_build(arb_ptr * tree, arb_srcptr roots, long len, long prec) + void _arb_poly_compose(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) + void arb_poly_compose(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) + void _arb_poly_compose_horner(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) + void arb_poly_compose_horner(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) + void _arb_poly_compose_divconquer(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long prec) + void arb_poly_compose_divconquer(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long prec) + void _arb_poly_compose_series_horner(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long n, long prec) + void arb_poly_compose_series_horner(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long n, long prec) + void _arb_poly_compose_series(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long n, long prec) + void arb_poly_compose_series(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long n, long prec) + void _arb_poly_revert_series_lagrange(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) + void arb_poly_revert_series_lagrange(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) + void _arb_poly_revert_series_newton(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) + void arb_poly_revert_series_newton(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) + void _arb_poly_revert_series_lagrange_fast(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) + void arb_poly_revert_series_lagrange_fast(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) + void _arb_poly_revert_series(arb_ptr Qinv, arb_srcptr Q, long Qlen, long n, long prec) + void arb_poly_revert_series(arb_poly_t Qinv, const arb_poly_t Q, long n, long prec) + + void _arb_poly_evaluate_horner(arb_t res, arb_srcptr f, long len, const arb_t a, long prec) + void arb_poly_evaluate_horner(arb_t res, const arb_poly_t f, const arb_t a, long prec) + void _arb_poly_evaluate_rectangular(arb_t y, arb_srcptr poly, long len, const arb_t x, long prec) + void arb_poly_evaluate_rectangular(arb_t res, const arb_poly_t f, const arb_t a, long prec) + void _arb_poly_evaluate(arb_t res, arb_srcptr f, long len, const arb_t a, long prec) + void arb_poly_evaluate(arb_t res, const arb_poly_t f, const arb_t a, long prec) + void _arb_poly_evaluate2_horner(arb_t y, arb_t z, arb_srcptr f, long len, const arb_t x, long prec) + void arb_poly_evaluate2_horner(arb_t y, arb_t z, const arb_poly_t f, const arb_t x, long prec) + void _arb_poly_evaluate2_rectangular(arb_t y, arb_t z, arb_srcptr f, long len, const arb_t x, long prec) + void arb_poly_evaluate2_rectangular(arb_t y, arb_t z, const arb_poly_t f, const arb_t x, long prec) + void _arb_poly_evaluate2(arb_t y, arb_t z, arb_srcptr f, long len, const arb_t x, long prec) + void arb_poly_evaluate2(arb_t y, arb_t z, const arb_poly_t f, const arb_t x, long prec) + + void _arb_poly_evaluate_vec_iter(arb_ptr ys, arb_srcptr poly, long plen, arb_srcptr xs, long n, long prec) + void arb_poly_evaluate_vec_iter(arb_ptr ys, const arb_poly_t poly, arb_srcptr xs, long n, long prec) + void _arb_poly_evaluate_vec_fast_precomp(arb_ptr vs, arb_srcptr poly, long plen, arb_ptr * tree, long len, long prec) + void _arb_poly_evaluate_vec_fast(arb_ptr ys, arb_srcptr poly, long plen, arb_srcptr xs, long n, long prec) + void arb_poly_evaluate_vec_fast(arb_ptr ys, const arb_poly_t poly, arb_srcptr xs, long n, long prec) + void _arb_poly_interpolate_newton(arb_ptr poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) + void arb_poly_interpolate_newton(arb_poly_t poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) + void _arb_poly_interpolate_barycentric(arb_ptr poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) + void arb_poly_interpolate_barycentric(arb_poly_t poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) + void _arb_poly_interpolation_weights(arb_ptr w, arb_ptr * tree, long len, long prec) + void _arb_poly_interpolate_fast_precomp(arb_ptr poly, arb_srcptr ys, arb_ptr * tree, arb_srcptr weights, long len, long prec) + void _arb_poly_interpolate_fast(arb_ptr poly, arb_srcptr xs, arb_srcptr ys, long len, long prec) + void arb_poly_interpolate_fast(arb_poly_t poly, arb_srcptr xs, arb_srcptr ys, long n, long prec) + + void _arb_poly_derivative(arb_ptr res, arb_srcptr poly, long len, long prec) + void arb_poly_derivative(arb_poly_t res, const arb_poly_t poly, long prec) + void _arb_poly_integral(arb_ptr res, arb_srcptr poly, long len, long prec) + void arb_poly_integral(arb_poly_t res, const arb_poly_t poly, long prec) + + void arb_poly_borel_transform(arb_poly_t res, const arb_poly_t poly, long prec) + void _arb_poly_borel_transform(arb_ptr res, arb_srcptr poly, long len, long prec) + void arb_poly_inv_borel_transform(arb_poly_t res, const arb_poly_t poly, long prec) + void _arb_poly_inv_borel_transform(arb_ptr res, arb_srcptr poly, long len, long prec) + void _arb_poly_binomial_transform_basecase(arb_ptr b, arb_srcptr a, long alen, long len, long prec) + void arb_poly_binomial_transform_basecase(arb_poly_t b, const arb_poly_t a, long len, long prec) + void _arb_poly_binomial_transform_convolution(arb_ptr b, arb_srcptr a, long alen, long len, long prec) + void arb_poly_binomial_transform_convolution(arb_poly_t b, const arb_poly_t a, long len, long prec) + void _arb_poly_binomial_transform(arb_ptr b, arb_srcptr a, long alen, long len, long prec) + void arb_poly_binomial_transform(arb_poly_t b, const arb_poly_t a, long len, long prec) + + void _arb_poly_pow_ui_trunc_binexp(arb_ptr res, arb_srcptr f, long flen, ulong exp, long len, long prec) + void arb_poly_pow_ui_trunc_binexp(arb_poly_t res, const arb_poly_t poly, ulong exp, long len, long prec) + void _arb_poly_pow_ui(arb_ptr res, arb_srcptr f, long flen, ulong exp, long prec) + void arb_poly_pow_ui(arb_poly_t res, const arb_poly_t poly, ulong exp, long prec) + void _arb_poly_pow_series(arb_ptr h, arb_srcptr f, long flen, arb_srcptr g, long glen, long len, long prec) + void arb_poly_pow_series(arb_poly_t h, const arb_poly_t f, const arb_poly_t g, long len, long prec) + void _arb_poly_pow_arb_series(arb_ptr h, arb_srcptr f, long flen, const arb_t g, long len, long prec) + void arb_poly_pow_arb_series(arb_poly_t h, const arb_poly_t f, const arb_t g, long len, long prec) + void _arb_poly_rsqrt_series(arb_ptr g, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_rsqrt_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + void _arb_poly_sqrt_series(arb_ptr g, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_sqrt_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + void _arb_poly_log_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) + void arb_poly_log_series(arb_poly_t res, const arb_poly_t f, long n, long prec) + void _arb_poly_atan_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) + void arb_poly_atan_series(arb_poly_t res, const arb_poly_t f, long n, long prec) + void _arb_poly_asin_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) + void arb_poly_asin_series(arb_poly_t res, const arb_poly_t f, long n, long prec) + void _arb_poly_acos_series(arb_ptr res, arb_srcptr f, long flen, long n, long prec) + void arb_poly_acos_series(arb_poly_t res, const arb_poly_t f, long n, long prec) + void _arb_poly_exp_series_basecase(arb_ptr f, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_exp_series_basecase(arb_poly_t f, const arb_poly_t h, long n, long prec) + void _arb_poly_exp_series(arb_ptr f, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_exp_series(arb_poly_t f, const arb_poly_t h, long n, long prec) + void _arb_poly_sin_cos_series_basecase(arb_ptr s, arb_ptr c, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_sin_cos_series_basecase(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) + void _arb_poly_sin_cos_series_tangent(arb_ptr s, arb_ptr c, const arb_srcptr h, long hlen, long len, long prec) + void arb_poly_sin_cos_series_tangent(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) + void _arb_poly_sin_cos_series(arb_ptr s, arb_ptr c, const arb_srcptr h, long hlen, long len, long prec) + void arb_poly_sin_cos_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) + void _arb_poly_sin_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_sin_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + void _arb_poly_cos_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_cos_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + void _arb_poly_tan_series(arb_ptr g, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_tan_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + void _arb_poly_compose_series_brent_kung(arb_ptr res, arb_srcptr poly1, long len1, arb_srcptr poly2, long len2, long n, long prec) + void arb_poly_compose_series_brent_kung(arb_poly_t res, const arb_poly_t poly1, const arb_poly_t poly2, long n, long prec) + void _arb_poly_evaluate_acb_horner(acb_t res, arb_srcptr f, long len, const acb_t x, long prec) + void arb_poly_evaluate_acb_horner(acb_t res, const arb_poly_t f, const acb_t a, long prec) + void _arb_poly_evaluate_acb_rectangular(acb_t y, arb_srcptr poly, long len, const acb_t x, long prec) + void arb_poly_evaluate_acb_rectangular(acb_t res, const arb_poly_t f, const acb_t a, long prec) + void _arb_poly_evaluate_acb(acb_t res, arb_srcptr f, long len, const acb_t x, long prec) + void arb_poly_evaluate_acb(acb_t res, const arb_poly_t f, const acb_t a, long prec) + void _arb_poly_evaluate2_acb_horner(acb_t y, acb_t z, arb_srcptr f, long len, const acb_t x, long prec) + void arb_poly_evaluate2_acb_horner(acb_t y, acb_t z, const arb_poly_t f, const acb_t x, long prec) + void _arb_poly_evaluate2_acb_rectangular(acb_t y, acb_t z, arb_srcptr f, long len, const acb_t x, long prec) + void arb_poly_evaluate2_acb_rectangular(acb_t y, acb_t z, const arb_poly_t f, const acb_t x, long prec) + void _arb_poly_evaluate2_acb(acb_t y, acb_t z, arb_srcptr f, long len, const acb_t x, long prec) + void arb_poly_evaluate2_acb(acb_t y, acb_t z, const arb_poly_t f, const acb_t x, long prec) + void _arb_poly_gamma_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_gamma_series(arb_poly_t res, const arb_poly_t f, long n, long prec) + void _arb_poly_rgamma_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_rgamma_series(arb_poly_t res, const arb_poly_t f, long n, long prec) + void _arb_poly_lgamma_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_lgamma_series(arb_poly_t res, const arb_poly_t f, long n, long prec) + void _arb_poly_rising_ui_series(arb_ptr res, arb_srcptr f, long flen, ulong r, long trunc, long prec) + void arb_poly_rising_ui_series(arb_poly_t res, const arb_poly_t f, ulong r, long trunc, long prec) + void _arb_poly_zeta_series(arb_ptr res, arb_srcptr h, long hlen, const arb_t a, int deflate, long len, long prec) + void arb_poly_zeta_series(arb_poly_t res, const arb_poly_t f, const arb_t a, int deflate, long n, long prec) + void _arb_poly_riemann_siegel_theta_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_riemann_siegel_theta_series(arb_poly_t res, const arb_poly_t h, long n, long prec) + void _arb_poly_riemann_siegel_z_series(arb_ptr res, arb_srcptr h, long hlen, long len, long prec) + void arb_poly_riemann_siegel_z_series(arb_poly_t res, const arb_poly_t h, long n, long prec) + + void arb_poly_swinnerton_dyer_ui(arb_poly_t poly, ulong n, long prec) + int arb_poly_get_unique_fmpz_poly(fmpz_poly_t res, const arb_poly_t src) + + void _arb_poly_sin_cos_pi_series(arb_ptr s, arb_ptr c, const arb_srcptr h, long hlen, long len, long prec) + void arb_poly_sin_cos_pi_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, long n, long prec) + void _arb_poly_sin_pi_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_sin_pi_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + void _arb_poly_cos_pi_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_cos_pi_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + void _arb_poly_cot_pi_series(arb_ptr g, arb_srcptr h, long hlen, long n, long prec) + void arb_poly_cot_pi_series(arb_poly_t g, const arb_poly_t h, long n, long prec) + + void arb_poly_lambertw_series(arb_poly_t res, const arb_poly_t z, int flags, long len, long prec) diff --git a/src/flint/flintlib/arf.pxd b/src/flint/flintlib/arf.pxd new file mode 100644 index 00000000..38ac745a --- /dev/null +++ b/src/flint/flintlib/arf.pxd @@ -0,0 +1,138 @@ +from flint.flintlib.fmpz cimport fmpz_t, fmpz_struct +from flint._flint cimport mp_limb_t, ulong, flint_rand_t +from flint.flintlib.fmpq cimport fmpq_t +from flint.flintlib.mag cimport mag_t + +cdef extern from "arf.h": + ctypedef struct arf_struct: + fmpz_struct exp + long size + mp_limb_t d0 + mp_limb_t d1 + + ctypedef arf_struct arf_t[1] + ctypedef arf_struct * arf_ptr + ctypedef const arf_struct * arf_srcptr + + ctypedef int arf_rnd_t + cdef arf_rnd_t ARF_RND_DOWN + cdef arf_rnd_t ARF_RND_NEAR + cdef arf_rnd_t ARF_RND_FLOOR + cdef arf_rnd_t ARF_RND_CEIL + cdef arf_rnd_t ARF_RND_UP + + void arf_init(arf_t x) + void arf_clear(arf_t x) + void arf_zero(arf_t x) + void arf_pos_inf(arf_t x) + void arf_neg_inf(arf_t x) + void arf_nan(arf_t x) + int arf_is_special(const arf_t x) + int arf_is_zero(const arf_t x) + int arf_is_pos_inf(const arf_t x) + int arf_is_neg_inf(const arf_t x) + int arf_is_nan(const arf_t x) + int arf_is_normal(const arf_t x) + int arf_is_finite(const arf_t x) + int arf_is_inf(const arf_t x) + void arf_one(arf_t x) + int arf_is_one(const arf_t x) + int arf_sgn(const arf_t x) + int arf_cmp(const arf_t x, const arf_t y) + int arf_cmpabs(const arf_t x, const arf_t y) + void arf_swap(arf_t y, arf_t x) + void arf_set(arf_t y, const arf_t x) + void arf_neg(arf_t y, const arf_t x) + void arf_init_set_ui(arf_t x, ulong v) + void arf_init_set_si(arf_t x, long v) + void arf_set_ui(arf_t x, ulong v) + void arf_set_si(arf_t x, long v) + int arf_cmpabs_ui(const arf_t x, ulong y) + void arf_init_set_shallow(arf_t z, const arf_t x) + void arf_init_neg_shallow(arf_t z, const arf_t x) + void arf_init_set_mag_shallow(arf_t y, const mag_t x) + void arf_init_neg_mag_shallow(arf_t z, const mag_t x) + int arf_cmpabs_mag(const arf_t x, const mag_t y) + int arf_mag_cmpabs(const mag_t x, const arf_t y) + void arf_set_fmpz(arf_t y, const fmpz_t x) + int arf_set_round_ui(arf_t x, ulong v, long prec, arf_rnd_t rnd) + int arf_set_round_si(arf_t x, long v, long prec, arf_rnd_t rnd) + int arf_set_round_fmpz(arf_t y, const fmpz_t x, long prec, arf_rnd_t rnd) + int arf_set_round(arf_t y, const arf_t x, long prec, arf_rnd_t rnd) + int arf_neg_round(arf_t y, const arf_t x, long prec, arf_rnd_t rnd) + int arf_equal(const arf_t x, const arf_t y) + void arf_min(arf_t z, const arf_t a, const arf_t b) + void arf_max(arf_t z, const arf_t a, const arf_t b) + void arf_abs(arf_t y, const arf_t x) + long arf_bits(const arf_t x) + void arf_bot(fmpz_t e, const arf_t x) + int arf_is_int(const arf_t x) + int arf_is_int_2exp_si(const arf_t x, long e) + int arf_cmp_2exp_si(const arf_t x, long e) + int arf_cmpabs_2exp_si(const arf_t x, long e) + void arf_set_si_2exp_si(arf_t x, long man, long exp) + void arf_set_ui_2exp_si(arf_t x, ulong man, long exp) + void arf_mul_2exp_si(arf_t y, const arf_t x, long e) + void arf_mul_2exp_fmpz(arf_t y, const arf_t x, const fmpz_t e) + int arf_set_round_fmpz_2exp(arf_t y, const fmpz_t x, const fmpz_t exp, long prec, arf_rnd_t rnd) + void arf_abs_bound_lt_2exp_fmpz(fmpz_t b, const arf_t x) + void arf_abs_bound_le_2exp_fmpz(fmpz_t b, const arf_t x) + long arf_abs_bound_lt_2exp_si(const arf_t x) + void arf_get_fmpz_2exp(fmpz_t man, fmpz_t exp, const arf_t x) + void arf_get_fmpz(fmpz_t z, const arf_t x, arf_rnd_t rnd) + long arf_get_si(const arf_t x, arf_rnd_t rnd) + int arf_get_fmpz_fixed_fmpz(fmpz_t y, const arf_t x, const fmpz_t e) + int arf_get_fmpz_fixed_si(fmpz_t y, const arf_t x, long e) + void arf_set_fmpz_2exp(arf_t x, const fmpz_t man, const fmpz_t exp) + void arf_floor(arf_t z, const arf_t x) + void arf_ceil(arf_t z, const arf_t x) + void arf_debug(const arf_t x) + void arf_print(const arf_t x) + void arf_printd(const arf_t y, long d) + void arf_randtest(arf_t x, flint_rand_t state, long bits, long mag_bits) + void arf_randtest_not_zero(arf_t x, flint_rand_t state, long bits, long mag_bits) + void arf_randtest_special(arf_t x, flint_rand_t state, long bits, long mag_bits) + int arf_mul(arf_t z, const arf_t x, const arf_t y, long prec, arf_rnd_t rnd) + int arf_neg_mul(arf_t z, const arf_t x, const arf_t y, long prec, arf_rnd_t rnd) + int arf_mul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) + int arf_mul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) + int arf_mul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) + int arf_add(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_add_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) + int arf_add_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) + int arf_add_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) + int arf_add_fmpz_2exp(arf_ptr z, arf_srcptr x, const fmpz_t y, const fmpz_t exp, long prec, arf_rnd_t rnd) + int arf_sub(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_sub_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) + int arf_sub_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) + int arf_sub_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) + int arf_addmul(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_addmul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) + int arf_addmul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) + int arf_addmul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) + int arf_submul(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_submul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) + int arf_submul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) + int arf_submul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) + int arf_div(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_div_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd) + int arf_ui_div(arf_ptr z, ulong x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_div_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd) + int arf_si_div(arf_ptr z, long x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_div_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd) + int arf_fmpz_div(arf_ptr z, const fmpz_t x, arf_srcptr y, long prec, arf_rnd_t rnd) + int arf_fmpz_div_fmpz(arf_ptr z, const fmpz_t x, const fmpz_t y, long prec, arf_rnd_t rnd) + int arf_sqrt(arf_ptr z, arf_srcptr x, long prec, arf_rnd_t rnd) + int arf_sqrt_ui(arf_t z, ulong x, long prec, arf_rnd_t rnd) + int arf_sqrt_fmpz(arf_t z, const fmpz_t x, long prec, arf_rnd_t rnd) + int arf_rsqrt(arf_ptr z, arf_srcptr x, long prec, arf_rnd_t rnd) + void arf_get_mag(mag_t y, const arf_t x) + void arf_get_mag_lower(mag_t y, const arf_t x) + void arf_set_mag(arf_t y, const mag_t x) + void mag_init_set_arf(mag_t y, const arf_t x) + void arf_mag_add_ulp(mag_t z, const mag_t x, const arf_t y, long prec) + void arf_mag_set_ulp(mag_t z, const arf_t y, long prec) + void arf_get_fmpq(fmpq_t y, const arf_t x) + int arf_set_fmpq(arf_t y, const fmpq_t x, long prec, arf_rnd_t rnd) + double arf_get_d(const arf_t x, arf_rnd_t rnd) + void arf_set_d(arf_t x, double v) diff --git a/src/flint/flintlib/arith.pxd b/src/flint/flintlib/arith.pxd new file mode 100644 index 00000000..64ce4308 --- /dev/null +++ b/src/flint/flintlib/arith.pxd @@ -0,0 +1,23 @@ +from flint._flint cimport ulong +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t +from flint.flintlib.fmpq_poly cimport fmpq_poly_t +from flint.flintlib.fmpq cimport fmpq_t + +cdef extern from "flint/arith.h": + void arith_number_of_partitions(fmpz_t res, ulong n) + int arith_moebius_mu(fmpz_t n) + void arith_divisor_sigma(fmpz_t v, ulong k, fmpz_t n) + void arith_euler_phi(fmpz_t v, fmpz_t n) + void arith_bell_number(fmpz_t v, ulong n) + void arith_euler_number(fmpz_t v, ulong n) + void arith_bernoulli_number(fmpq_t v, ulong n) + void arith_stirling_number_1(fmpz_t s, long n, long k) + void arith_stirling_number_2(fmpz_t s, long n, long k) + void arith_harmonic_number(fmpq_t v, ulong n) + void arith_bernoulli_polynomial(fmpq_poly_t v, ulong n) + void arith_euler_polynomial(fmpq_poly_t v, ulong n) + void arith_legendre_polynomial(fmpq_poly_t v, ulong n) + void arith_chebyshev_t_polynomial(fmpz_poly_t v, ulong n) + void arith_chebyshev_u_polynomial(fmpz_poly_t v, ulong n) + void arith_cyclotomic_polynomial(fmpz_poly_t v, ulong n) diff --git a/src/flint/flintlib/bernoulli.pxd b/src/flint/flintlib/bernoulli.pxd new file mode 100644 index 00000000..a1fb9ee2 --- /dev/null +++ b/src/flint/flintlib/bernoulli.pxd @@ -0,0 +1,6 @@ +from flint._flint cimport ulong +from flint.flintlib.fmpq cimport fmpq_t + +cdef extern from "bernoulli.h": + void bernoulli_fmpq_ui(fmpq_t, ulong) + void bernoulli_cache_compute(long n) diff --git a/src/flint/flintlib/dirichlet.pxd b/src/flint/flintlib/dirichlet.pxd new file mode 100644 index 00000000..6ab7306f --- /dev/null +++ b/src/flint/flintlib/dirichlet.pxd @@ -0,0 +1,61 @@ +from flint._flint cimport ulong +from flint.flintlib.nmod_vec cimport nmod_t + +cdef extern from "dirichlet.h": + ctypedef struct dirichlet_group_struct: + ulong q + ulong q_even + nmod_t mod + ulong rad_q + ulong phi_q + long neven + long num + ulong expo + void * P + ulong * generators + ulong * PHI + ctypedef dirichlet_group_struct dirichlet_group_t[1] + + ctypedef struct dirichlet_char_struct: + ulong n + ulong * log + ctypedef dirichlet_char_struct dirichlet_char_t[1] + + ulong dirichlet_group_size(const dirichlet_group_t G) + void dirichlet_group_init(dirichlet_group_t G, ulong q) + void dirichlet_group_clear(dirichlet_group_t G) + ulong dirichlet_number_primitive(const dirichlet_group_t G) + + void dirichlet_char_init(dirichlet_char_t x, const dirichlet_group_t G) + void dirichlet_char_clear(dirichlet_char_t x) + void dirichlet_char_print(const dirichlet_group_t G, const dirichlet_char_t x) + + void dirichlet_char_set(dirichlet_char_t x, const dirichlet_group_t G, const dirichlet_char_t y) + int dirichlet_char_eq(const dirichlet_char_t x, const dirichlet_char_t y) + int dirichlet_parity_char(const dirichlet_group_t G, const dirichlet_char_t x) + ulong dirichlet_conductor_char(const dirichlet_group_t G, const dirichlet_char_t x) + ulong dirichlet_order_char(const dirichlet_group_t G, const dirichlet_char_t x) + + void dirichlet_char_log(dirichlet_char_t x, const dirichlet_group_t G, ulong m) + ulong dirichlet_char_exp(const dirichlet_group_t G, const dirichlet_char_t x) + ulong _dirichlet_char_exp(dirichlet_char_t x, const dirichlet_group_t G) + void dirichlet_char_index(dirichlet_char_t x, const dirichlet_group_t G, ulong j) + ulong dirichlet_index_char(const dirichlet_group_t G, const dirichlet_char_t x) + void dirichlet_char_one(dirichlet_char_t x, const dirichlet_group_t G) + void dirichlet_char_first_primitive(dirichlet_char_t x, const dirichlet_group_t G) + int dirichlet_char_next(dirichlet_char_t x, const dirichlet_group_t G) + int dirichlet_char_next_primitive(dirichlet_char_t x, const dirichlet_group_t G) + void dirichlet_char_mul(dirichlet_char_t c, const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b) + void dirichlet_char_pow(dirichlet_char_t c, const dirichlet_group_t G, const dirichlet_char_t a, ulong n) + void dirichlet_char_lower(dirichlet_char_t y, const dirichlet_group_t H, const dirichlet_char_t x, const dirichlet_group_t G) + void dirichlet_char_lift(dirichlet_char_t y, const dirichlet_group_t G, const dirichlet_char_t x, const dirichlet_group_t H) + + cdef ulong DIRICHLET_CHI_NULL + + ulong dirichlet_pairing(const dirichlet_group_t G, ulong m, ulong n) + ulong dirichlet_pairing_char(const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b) + + int dirichlet_char_is_principal(const dirichlet_group_t G, const dirichlet_char_t chi) + int dirichlet_char_is_real(const dirichlet_group_t G, const dirichlet_char_t chi) + int dirichlet_char_is_primitive(const dirichlet_group_t G, const dirichlet_char_t chi) + ulong dirichlet_chi(const dirichlet_group_t G, const dirichlet_char_t chi, ulong n) diff --git a/src/flint/flintlib/fmpq.pxd b/src/flint/flintlib/fmpq.pxd new file mode 100644 index 00000000..5af96777 --- /dev/null +++ b/src/flint/flintlib/fmpq.pxd @@ -0,0 +1,49 @@ +from flint._flint cimport ulong, flint_rand_t, mp_bitcnt_t +from flint.flintlib.fmpz cimport fmpz_struct, fmpz_t + +cdef extern from "flint/fmpq.h": + ctypedef struct fmpq_struct: + fmpz_struct num + fmpz_struct den + ctypedef fmpq_struct fmpq_t[1] + fmpz_struct * fmpq_numref(fmpq_t x) + fmpz_struct * fmpq_denref(fmpq_t x) + void fmpq_init(fmpq_t x) + void fmpq_clear(fmpq_t x) + void fmpq_zero(fmpq_t res) + void fmpq_one(fmpq_t res) + int fmpq_equal(fmpq_t x, fmpq_t y) + int fmpq_sgn(fmpq_t x) + int fmpq_is_zero(fmpq_t x) + int fmpq_is_one(fmpq_t x) + void fmpq_set(fmpq_t dest, fmpq_t src) + void fmpq_neg(fmpq_t dest, fmpq_t src) + void fmpq_canonicalise(fmpq_t res) + int fmpq_is_canonical(fmpq_t x) + void fmpq_set_si(fmpq_t res, long p, ulong q) + #void fmpq_set_mpq(fmpq_t dest, mpq_t src) + #void fmpq_get_mpq(mpq_t dest, fmpq_t src) + void fmpq_print(fmpq_t x) + void fmpq_randtest(fmpq_t res, flint_rand_t state, mp_bitcnt_t bits) + void fmpq_randbits(fmpq_t res, flint_rand_t state, mp_bitcnt_t bits) + void fmpq_add(fmpq_t res, fmpq_t op1, fmpq_t op2) + void fmpq_sub(fmpq_t res, fmpq_t op1, fmpq_t op2) + void fmpq_mul(fmpq_t res, fmpq_t op1, fmpq_t op2) + void fmpq_mul_fmpz(fmpq_t res, fmpq_t op, fmpz_t x) + void fmpq_addmul(fmpq_t res, fmpq_t op1, fmpq_t op2) + void fmpq_submul(fmpq_t res, fmpq_t op1, fmpq_t op2) + void fmpq_inv(fmpq_t dest, fmpq_t src) + void fmpq_div(fmpq_t res, fmpq_t op1, fmpq_t op2) + void fmpq_div_fmpz(fmpq_t res, fmpq_t op, fmpz_t x) + int fmpq_mod_fmpz(fmpz_t res, fmpq_t x, fmpz_t mod) + int fmpq_pow_fmpz(fmpq_t a, const fmpq_t b, const fmpz_t e) + int fmpq_reconstruct_fmpz(fmpq_t res, fmpz_t a, fmpz_t m) + int fmpq_reconstruct_fmpz_2(fmpq_t res, fmpz_t a, fmpz_t m, fmpz_t N, fmpz_t D) + mp_bitcnt_t fmpq_height_bits(fmpq_t x) + void fmpq_height(fmpz_t height, fmpq_t x) + void fmpq_next_calkin_wilf(fmpq_t res, fmpq_t x) + void fmpq_next_signed_calkin_wilf(fmpq_t res, fmpq_t x) + void fmpq_next_minimal(fmpq_t res, fmpq_t x) + void fmpq_next_signed_minimal(fmpq_t res, fmpq_t x) + void fmpq_harmonic_ui(fmpq_t res, ulong n) + void fmpq_dedekind_sum(fmpq_t s, const fmpz_t h, const fmpz_t k) diff --git a/src/flint/flintlib/fmpq_mat.pxd b/src/flint/flintlib/fmpq_mat.pxd new file mode 100644 index 00000000..4c0982a3 --- /dev/null +++ b/src/flint/flintlib/fmpq_mat.pxd @@ -0,0 +1,60 @@ +from flint._flint cimport flint_rand_t, mp_bitcnt_t +from flint.flintlib.fmpz cimport fmpz_struct, fmpz_t +from flint.flintlib.fmpq cimport fmpq_struct, fmpq_t +from flint.flintlib.fmpz_mat cimport fmpz_mat_t +from flint.flintlib.fmpq_poly cimport fmpq_poly_t + +cdef extern from "flint/fmpq_mat.h": + ctypedef struct fmpq_mat_struct: + fmpq_struct * entries + long r + long c + fmpq_struct ** rows + ctypedef fmpq_mat_struct fmpq_mat_t[1] + fmpq_struct * fmpq_mat_entry(fmpq_mat_t mat, long i, long j) + fmpz_struct * fmpq_mat_entry_num(fmpq_mat_t mat, long i, long j) + fmpz_struct * fmpq_mat_entry_den(fmpq_mat_t mat, long i, long j) + long fmpq_mat_nrows(fmpq_mat_t mat) + long fmpq_mat_ncols(fmpq_mat_t mat) + void fmpq_mat_init(fmpq_mat_t mat, long rows, long cols) + void fmpq_mat_clear(fmpq_mat_t mat) + void fmpq_mat_print(fmpq_mat_t mat) + void fmpq_mat_randbits(fmpq_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) + void fmpq_mat_randtest(fmpq_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) + void fmpq_mat_hilbert_matrix(fmpq_mat_t mat) + void fmpq_mat_set(fmpq_mat_t dest, fmpq_mat_t src) + void fmpq_mat_zero(fmpq_mat_t mat) + void fmpq_mat_one(fmpq_mat_t mat) + void fmpq_mat_add(fmpq_mat_t mat, fmpq_mat_t mat1, fmpq_mat_t mat2) + void fmpq_mat_sub(fmpq_mat_t mat, fmpq_mat_t mat1, fmpq_mat_t mat2) + void fmpq_mat_neg(fmpq_mat_t rop, fmpq_mat_t op) + void fmpq_mat_scalar_mul_fmpz(fmpq_mat_t rop, fmpq_mat_t op, fmpz_t x) + void fmpq_mat_scalar_div_fmpz(fmpq_mat_t rop, fmpq_mat_t op, fmpz_t x) + int fmpq_mat_equal(fmpq_mat_t mat1, fmpq_mat_t mat2) + int fmpq_mat_is_integral(fmpq_mat_t mat) + int fmpq_mat_is_zero(fmpq_mat_t mat) + int fmpq_mat_is_empty(fmpq_mat_t mat) + int fmpq_mat_is_square(fmpq_mat_t mat) + int fmpq_mat_get_fmpz_mat(fmpz_mat_t dest, fmpq_mat_t mat) + void fmpq_mat_get_fmpz_mat_entrywise(fmpz_mat_t num, fmpz_mat_t den, fmpq_mat_t mat) + void fmpq_mat_get_fmpz_mat_matwise(fmpz_mat_t num, fmpz_t den, fmpq_mat_t mat) + void fmpq_mat_get_fmpz_mat_rowwise(fmpz_mat_t num, fmpz_struct * den, fmpq_mat_t mat) + void fmpq_mat_get_fmpz_mat_colwise(fmpz_mat_t num, fmpz_struct * den, fmpq_mat_t mat) + void fmpq_mat_get_fmpz_mat_rowwise_2(fmpz_mat_t num, fmpz_mat_t num2, fmpz_struct * den, fmpq_mat_t mat, fmpq_mat_t mat2) + void fmpq_mat_get_fmpz_mat_mod_fmpz(fmpz_mat_t dest, fmpq_mat_t mat, fmpz_t mod) + void fmpq_mat_set_fmpz_mat(fmpq_mat_t dest, fmpz_mat_t src) + void fmpq_mat_set_fmpz_mat_div_fmpz(fmpq_mat_t X, fmpz_mat_t Xmod, fmpz_t div) + int fmpq_mat_set_fmpz_mat_mod_fmpz(fmpq_mat_t X, fmpz_mat_t Xmod, fmpz_t mod) + void fmpq_mat_mul(fmpq_mat_t C, fmpq_mat_t A, fmpq_mat_t B) + void fmpq_mat_mul_fmpz_mat(fmpq_mat_t C, fmpq_mat_t A, fmpz_mat_t B) + void fmpq_mat_mul_r_fmpz_mat(fmpq_mat_t C, fmpz_mat_t A, fmpq_mat_t B) + void fmpq_mat_det(fmpq_t det, fmpq_mat_t mat) + int fmpq_mat_solve_fraction_free(fmpq_mat_t X, fmpq_mat_t A, fmpq_mat_t B) + int fmpq_mat_solve_dixon(fmpq_mat_t X, fmpq_mat_t A, fmpq_mat_t B) + int fmpq_mat_solve_fmpz_mat(fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B) + int fmpq_mat_inv(fmpq_mat_t B, fmpq_mat_t A) + long fmpq_mat_rref(fmpq_mat_t B, fmpq_mat_t A) + void fmpq_mat_transpose(fmpq_mat_t B, fmpq_mat_t A) + + void fmpq_mat_charpoly(fmpq_poly_t cp, const fmpq_mat_t mat) + void fmpq_mat_minpoly(fmpq_poly_t cp, const fmpq_mat_t mat) diff --git a/src/flint/flintlib/fmpq_poly.pxd b/src/flint/flintlib/fmpq_poly.pxd new file mode 100644 index 00000000..eaf0373e --- /dev/null +++ b/src/flint/flintlib/fmpq_poly.pxd @@ -0,0 +1,119 @@ +from flint._flint cimport mp_bitcnt_t, flint_rand_t, ulong +from flint.flintlib.fmpz cimport fmpz_struct, fmpz_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t +from flint.flintlib.fmpq cimport fmpq_t + +cdef extern from "flint/fmpq_poly.h": + ctypedef struct fmpq_poly_struct: + fmpz_struct * coeffs + long alloc + long length + fmpz_t den + ctypedef fmpq_poly_struct fmpq_poly_t[1] + void fmpq_poly_init(fmpq_poly_t poly) + void fmpq_poly_init2(fmpq_poly_t poly, long alloc) + void fmpq_poly_realloc(fmpq_poly_t poly, long alloc) + void fmpq_poly_fit_length(fmpq_poly_t poly, long len) + void fmpq_poly_clear(fmpq_poly_t poly) + void _fmpq_poly_normalise(fmpq_poly_t poly) + void fmpq_poly_canonicalise(fmpq_poly_t poly) + int fmpq_poly_is_canonical(fmpq_poly_t poly) + fmpz_struct * fmpq_poly_numref(fmpq_poly_t poly) + fmpz_struct * fmpq_poly_denref(fmpq_poly_t poly) + void fmpq_poly_get_numerator(fmpz_poly_t res, fmpq_poly_t poly) + long fmpq_poly_degree(fmpq_poly_t poly) + long fmpq_poly_length(fmpq_poly_t poly) + void fmpq_poly_randtest(fmpq_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits_in) + void fmpq_poly_randtest_unsigned(fmpq_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits_in) + void fmpq_poly_randtest_not_zero(fmpq_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits_in) + void fmpq_poly_set(fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_set_si(fmpq_poly_t poly, long x) + void fmpq_poly_set_ui(fmpq_poly_t poly, ulong x) + void fmpq_poly_set_fmpz(fmpq_poly_t poly, fmpz_t x) + void fmpq_poly_set_fmpq(fmpq_poly_t poly, fmpq_t x) + #void fmpq_poly_set_mpz(fmpq_poly_t poly, mpz_t x) + #void fmpq_poly_set_mpq(fmpq_poly_t poly, mpq_t x) + void fmpq_poly_set_fmpz_poly(fmpq_poly_t rop, fmpz_poly_t op) + #void _fmpq_poly_set_array_mpq(fmpz_struct * poly, fmpz_t den, mpq_t * a, long n) + #void fmpq_poly_set_array_mpq(fmpq_poly_t poly, mpq_t * a, long n) + int fmpq_poly_set_str(fmpq_poly_t poly, char * str) + char * fmpq_poly_get_str(fmpq_poly_t poly) + char * fmpq_poly_get_str_pretty(fmpq_poly_t poly, char * var) + void fmpq_poly_zero(fmpq_poly_t poly) + void fmpq_poly_one(fmpq_poly_t poly) + void fmpq_poly_neg(fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_inv(fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_swap(fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_truncate(fmpq_poly_t poly, long n) + void fmpq_poly_get_coeff_fmpq(fmpq_t x, fmpq_poly_t poly, long n) + void fmpq_poly_set_coeff_si(fmpq_poly_t poly, long n, long x) + void fmpq_poly_set_coeff_ui(fmpq_poly_t poly, long n, ulong x) + void fmpq_poly_set_coeff_fmpz(fmpq_poly_t poly, long n, fmpz_t x) + void fmpq_poly_set_coeff_fmpq(fmpq_poly_t poly, long n, fmpq_t x) + #void fmpq_poly_set_coeff_mpz(fmpq_poly_t poly, long n, mpz_t x) + #void fmpq_poly_set_coeff_mpq(fmpq_poly_t poly, long n, mpq_t x) + int fmpq_poly_equal(fmpq_poly_t poly1, fmpq_poly_t poly2) + int fmpq_poly_cmp(fmpq_poly_t left, fmpq_poly_t right) + int fmpq_poly_is_zero(fmpq_poly_t poly) + int fmpq_poly_is_one(fmpq_poly_t poly) + void fmpq_poly_add(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_sub(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_scalar_mul_si(fmpq_poly_t rop, fmpq_poly_t op, long c) + void fmpq_poly_scalar_mul_ui(fmpq_poly_t rop, fmpq_poly_t op, ulong c) + void fmpq_poly_scalar_mul_fmpz(fmpq_poly_t rop, fmpq_poly_t op, fmpz_t c) + #void fmpq_poly_scalar_mul_mpz(fmpq_poly_t rop, fmpq_poly_t op, mpz_t c) + void fmpq_poly_scalar_mul_fmpq(fmpq_poly_t rop, fmpq_poly_t op, fmpq_t c) + void fmpq_poly_scalar_div_si(fmpq_poly_t rop, fmpq_poly_t op, long c) + void fmpq_poly_scalar_div_ui(fmpq_poly_t rop, fmpq_poly_t op, ulong c) + void fmpq_poly_scalar_div_fmpz(fmpq_poly_t rop, fmpq_poly_t op, fmpz_t c) + #void fmpq_poly_scalar_div_mpz(fmpq_poly_t rop, fmpq_poly_t op, mpz_t c) + void fmpq_poly_scalar_div_fmpq(fmpq_poly_t rop, fmpq_poly_t op, fmpq_t c) + void fmpq_poly_mul(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_mullow(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2, long n) + void fmpq_poly_addmul(fmpq_poly_t rop, fmpq_poly_t op1, fmpq_poly_t op2) + void fmpq_poly_submul(fmpq_poly_t rop, fmpq_poly_t op1, fmpq_poly_t op2) + void fmpq_poly_pow(fmpq_poly_t rpoly, fmpq_poly_t poly, ulong e) + void fmpq_poly_shift_left(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_shift_right(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_divrem(fmpq_poly_t Q, fmpq_poly_t R, fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_div(fmpq_poly_t Q, fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_gcd(fmpq_poly_t g, fmpq_poly_t a, fmpq_poly_t b) + void fmpq_poly_xgcd(fmpq_poly_t G, fmpq_poly_t S, fmpq_poly_t T, const fmpq_poly_t A, const fmpq_poly_t B) + void fmpq_poly_rem(fmpq_poly_t R, fmpq_poly_t poly1, fmpq_poly_t poly2) + void fmpq_poly_inv_series(fmpq_poly_t Qinv, fmpq_poly_t Q, long n) + void fmpq_poly_div_series(fmpq_poly_t Q, fmpq_poly_t A, fmpq_poly_t B, long n) + void fmpq_poly_derivative(fmpq_poly_t res, fmpq_poly_t poly) + void fmpq_poly_integral(fmpq_poly_t res, fmpq_poly_t poly) + void fmpq_poly_invsqrt_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_sqrt_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_log_series(fmpq_poly_t res, fmpq_poly_t f, long n) + void fmpq_poly_exp_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_atan_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_atanh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_asin_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_asinh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_tan_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_sin_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_cos_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_sinh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_cosh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_tanh_series(fmpq_poly_t res, fmpq_poly_t poly, long n) + void fmpq_poly_evaluate_fmpz(fmpq_t res, fmpq_poly_t poly, fmpz_t a) + void fmpq_poly_evaluate_fmpq(fmpq_t res, fmpq_poly_t poly, fmpq_t a) + # void fmpq_poly_evaluate_mpq(mpq_t res, fmpq_poly_t poly, mpq_t a) + void fmpq_poly_interpolate_fmpz_vec(fmpq_poly_t poly, fmpz_struct * xs, fmpz_struct * ys, long n) + void fmpq_poly_compose(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2) + #void fmpq_poly_rescale(fmpq_poly_t res, fmpq_poly_t poly, mpq_t x) + #void fmpq_poly_content(mpq_t res, fmpq_poly_t poly) + void fmpq_poly_primitive_part(fmpq_poly_t res, fmpq_poly_t poly) + int fmpq_poly_is_monic(fmpq_poly_t poly) + void fmpq_poly_make_monic(fmpq_poly_t res, fmpq_poly_t poly) + int fmpq_poly_is_squarefree(fmpq_poly_t poly) + int fmpq_poly_debug(fmpq_poly_t poly) + #int fmpq_poly_fprint(FILE * file, fmpq_poly_t poly) + int fmpq_poly_print(fmpq_poly_t poly) + int fmpq_poly_print_pretty(fmpq_poly_t poly, char * var) + #int fmpq_poly_fread(FILE * file, fmpq_poly_t poly) + int fmpq_poly_read(fmpq_poly_t poly) + void fmpq_poly_compose_series(fmpq_poly_t res, fmpq_poly_t poly1, fmpq_poly_t poly2, long n) + void fmpq_poly_revert_series(fmpq_poly_t res, fmpq_poly_t poly1, long n) diff --git a/src/flint/flintlib/fmpz.pxd b/src/flint/flintlib/fmpz.pxd new file mode 100644 index 00000000..4c78ec52 --- /dev/null +++ b/src/flint/flintlib/fmpz.pxd @@ -0,0 +1,103 @@ +from flint._flint cimport fmpz_struct, ulong, mp_limb_t +from flint._flint cimport mp_size_t, mp_bitcnt_t + +cdef extern from "flint/fmpz.h": + ctypedef fmpz_struct fmpz_t[1] + int COEFF_IS_MPZ(fmpz_struct v) + void fmpz_init(fmpz_t op) + void fmpz_clear(fmpz_t op) + long fmpz_get_si(fmpz_t f) + ulong fmpz_get_ui(fmpz_t f) + void fmpz_set_si(fmpz_t f, long val) + void fmpz_set_ui(fmpz_t f, ulong val) + #void fmpz_get_mpz(mpz_t x, fmpz_t f) + #void fmpz_set_mpz(fmpz_t f, mpz_t x) + int fmpz_set_str(fmpz_t f, char * str, int b) + int fmpz_abs_fits_ui( fmpz_t f) + void fmpz_zero(fmpz_t f) + void fmpz_one(fmpz_t f) + int fmpz_is_zero(fmpz_t f) + int fmpz_is_one( fmpz_t f) + int fmpz_is_pm1( fmpz_t f) + void fmpz_set(fmpz_t f, fmpz_t g) + int fmpz_equal(fmpz_t f, fmpz_t g) + int fmpz_read(fmpz_t f) + int fmpz_print(fmpz_t x) + size_t fmpz_sizeinbase( fmpz_t f, int b) + char * fmpz_get_str(char * str, int b, fmpz_t f) + void fmpz_swap(fmpz_t f, fmpz_t g) + int fmpz_cmp( fmpz_t f, fmpz_t g) + int fmpz_cmp_ui( fmpz_t f, ulong g) + int fmpz_cmp_si( fmpz_t f, long g) + int fmpz_cmpabs( fmpz_t f, fmpz_t g) + int fmpz_equal_si(const fmpz_t f, long g) + int fmpz_is_even(fmpz_t f) + int fmpz_is_odd(fmpz_t f) + mp_size_t fmpz_size(fmpz_t f) + int fmpz_sgn(fmpz_t f) + mp_bitcnt_t fmpz_bits(fmpz_t f) + void fmpz_neg(fmpz_t f1, fmpz_t f2) + void fmpz_abs(fmpz_t f1, fmpz_t f2) + void fmpz_add(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_sub(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_mul_ui(fmpz_t f, fmpz_t g, ulong x) + void fmpz_mul_si(fmpz_t f, fmpz_t g, long x) + void fmpz_mul(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_mul_2exp(fmpz_t f, fmpz_t g, ulong exp) + void fmpz_add_ui(fmpz_t f, fmpz_t g, ulong x) + void fmpz_sub_ui(fmpz_t f, fmpz_t g, ulong x) + void fmpz_addmul_ui(fmpz_t f, fmpz_t g, ulong x) + void fmpz_submul_ui(fmpz_t f, fmpz_t g, ulong x) + void fmpz_addmul(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_submul(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_pow_ui(fmpz_t f, fmpz_t g, ulong exp) + void fmpz_powm_ui(fmpz_t f, fmpz_t g, ulong exp, fmpz_t m) + void fmpz_powm(fmpz_t f, fmpz_t g, fmpz_t e, fmpz_t m) + int fmpz_pow_fmpz(fmpz_t f, const fmpz_t g, const fmpz_t x) + int fmpz_sqrtmod(fmpz_t b, fmpz_t a, fmpz_t p) + void fmpz_sqrt(fmpz_t f, fmpz_t g) + void fmpz_sqrtrem(fmpz_t f, fmpz_t r, fmpz_t g) + void fmpz_root(fmpz_t r, const fmpz_t f, long n) + ulong fmpz_fdiv_ui(fmpz_t g, ulong h) + ulong fmpz_mod_ui(fmpz_t f, fmpz_t g, ulong h) + void fmpz_mod(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_gcd(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_lcm(fmpz_t f, fmpz_t g, fmpz_t h) + int fmpz_invmod(fmpz_t f, fmpz_t g, fmpz_t h) + long fmpz_remove(fmpz_t rop, fmpz_t op, fmpz_t f) + void fmpz_divexact(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_divexact_si(fmpz_t f, fmpz_t g, long h) + void fmpz_divexact_ui(fmpz_t f, fmpz_t g, ulong h) + void fmpz_cdiv_q(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_cdiv_q_si(fmpz_t f, fmpz_t g, long h) + void fmpz_cdiv_q_ui(fmpz_t f, fmpz_t g, ulong h) + void fmpz_fdiv_qr(fmpz_t f, fmpz_t s, fmpz_t g, fmpz_t h) + void fmpz_fdiv_q(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_fdiv_r(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_fdiv_q_ui(fmpz_t f, fmpz_t g, ulong h) + void fmpz_fdiv_q_si(fmpz_t f, fmpz_t g, long h) + void fmpz_fdiv_q_2exp(fmpz_t f, fmpz_t g, ulong exp) + void fmpz_tdiv_q(fmpz_t f, fmpz_t g, fmpz_t h) + void fmpz_tdiv_q_ui(fmpz_t f, fmpz_t g, ulong h) + void fmpz_tdiv_q_si(fmpz_t f, fmpz_t g, long h) + double fmpz_get_d_2exp(long * exp, fmpz_t f) + void fmpz_mul2_uiui(fmpz_t f, fmpz_t g, ulong h1, ulong h2) + void fmpz_divexact2_uiui(fmpz_t f, fmpz_t g, ulong h1, ulong h2) + void fmpz_fac_ui(fmpz_t f, ulong n) + void fmpz_bin_uiui(fmpz_t res, ulong n, ulong k) + void fmpz_CRT_ui(fmpz_t out, fmpz_t r1, fmpz_t m1, ulong r2, ulong m2) + void fmpz_CRT_ui_unsigned(fmpz_t out, fmpz_t r1, fmpz_t m1, ulong r2, ulong m2) + void fmpz_set_ui_mod(fmpz_t f, mp_limb_t x, mp_limb_t m) + int fmpz_moebius_mu(const fmpz_t f) + void fmpz_fib_ui(fmpz_t f, ulong n) + void fmpz_rfac_ui(fmpz_t r, const fmpz_t x, ulong n) + void fmpz_rfac_uiui(fmpz_t r, ulong x, ulong n) + void fmpz_primorial(fmpz_t res, ulong n) + int fmpz_is_perfect_power(fmpz_t root, const fmpz_t f) + int fmpz_jacobi(const fmpz_t a, const fmpz_t p) + int fmpz_is_prime(const fmpz_t n) + int fmpz_is_probabprime(const fmpz_t n) + void fmpz_complement(fmpz_t r, const fmpz_t f) + void fmpz_and(fmpz_t r, const fmpz_t a, const fmpz_t b) + void fmpz_or(fmpz_t r, const fmpz_t a, const fmpz_t b) + void fmpz_xor(fmpz_t r, const fmpz_t a, const fmpz_t b) diff --git a/src/flint/flintlib/fmpz_factor.pxd b/src/flint/flintlib/fmpz_factor.pxd new file mode 100644 index 00000000..f87316ba --- /dev/null +++ b/src/flint/flintlib/fmpz_factor.pxd @@ -0,0 +1,18 @@ +from flint._flint cimport fmpz_struct, ulong +from flint.flintlib.fmpz cimport fmpz_t + +cdef extern from "flint/fmpz_factor.h": + ctypedef struct fmpz_factor_struct: + int sign + fmpz_struct * p + fmpz_struct * exp + long alloc + long num + ctypedef fmpz_factor_struct fmpz_factor_t[1] + void fmpz_factor_init(fmpz_factor_t factor) + void fmpz_factor_clear(fmpz_factor_t factor) + void fmpz_factor(fmpz_factor_t factor, fmpz_t n) + int fmpz_factor_trial_range(fmpz_factor_t factor, const fmpz_t n, ulong start, ulong num_primes) + void fmpz_factor_expand(fmpz_t n, const fmpz_factor_t factor) + void _fmpz_factor_append(fmpz_factor_t factor, const fmpz_t p, ulong exp) + void fmpz_factor_smooth(fmpz_factor_t factor, fmpz_t n, long bits, int proved) diff --git a/src/flint/flintlib/fmpz_lll.pxd b/src/flint/flintlib/fmpz_lll.pxd new file mode 100644 index 00000000..864c2810 --- /dev/null +++ b/src/flint/flintlib/fmpz_lll.pxd @@ -0,0 +1,13 @@ +from flint.flintlib.fmpz_mat cimport fmpz_mat_t + +cdef extern from "flint/fmpz_lll.h": + ctypedef struct fmpz_lll_struct: + double delta + double eta + int rt + int gt + + ctypedef fmpz_lll_struct fmpz_lll_t[1] + + void fmpz_lll_context_init(fmpz_lll_t fl, double delta, double eta, int rt, int gt) + void fmpz_lll(fmpz_mat_t B, fmpz_mat_t U, const fmpz_lll_t fl) diff --git a/src/flint/flintlib/fmpz_mat.pxd b/src/flint/flintlib/fmpz_mat.pxd new file mode 100644 index 00000000..2ad7eaf1 --- /dev/null +++ b/src/flint/flintlib/fmpz_mat.pxd @@ -0,0 +1,58 @@ +from flint._flint cimport flint_rand_t, mp_bitcnt_t, ulong +from flint.flintlib.fmpz cimport fmpz_struct, fmpz_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t +from flint.flintlib.nmod_mat cimport nmod_mat_t + +cdef extern from "flint/fmpz_mat.h": + ctypedef struct fmpz_mat_struct: + fmpz_struct * entries + long r + long c + fmpz_struct ** rows + ctypedef fmpz_mat_struct fmpz_mat_t[1] + fmpz_struct * fmpz_mat_entry(fmpz_mat_t mat, long i, long j) + long fmpz_mat_nrows(fmpz_mat_t mat) + long fmpz_mat_ncols(fmpz_mat_t mat) + void fmpz_mat_init(fmpz_mat_t mat, long rows, long cols) + void fmpz_mat_init_set(fmpz_mat_t mat, fmpz_mat_t src) + void fmpz_mat_swap(fmpz_mat_t mat1, fmpz_mat_t mat2) + void fmpz_mat_set(fmpz_mat_t mat1, fmpz_mat_t mat2) + void fmpz_mat_clear(fmpz_mat_t mat) + int fmpz_mat_equal(fmpz_mat_t mat1, fmpz_mat_t mat2) + int fmpz_mat_is_zero( fmpz_mat_t mat) + int fmpz_mat_is_empty( fmpz_mat_t mat) + int fmpz_mat_is_square( fmpz_mat_t mat) + void fmpz_mat_zero(fmpz_mat_t mat) + void fmpz_mat_one(fmpz_mat_t mat) + void fmpz_mat_get_nmod_mat(nmod_mat_t mat, fmpz_mat_t mat2) + void fmpz_mat_randbits(fmpz_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) + void fmpz_mat_randtest(fmpz_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) + void fmpz_mat_randtest_unsigned(fmpz_mat_t mat, flint_rand_t state, mp_bitcnt_t bits) + void fmpz_mat_randrank(fmpz_mat_t mat, flint_rand_t state, long rank, mp_bitcnt_t bits) + int fmpz_mat_print_pretty( fmpz_mat_t mat) + void fmpz_mat_transpose(fmpz_mat_t B, fmpz_mat_t A) + void fmpz_mat_add(fmpz_mat_t C, fmpz_mat_t A, fmpz_mat_t B) + void fmpz_mat_sub(fmpz_mat_t C, fmpz_mat_t A, fmpz_mat_t B) + void fmpz_mat_neg(fmpz_mat_t B, fmpz_mat_t A) + void fmpz_mat_scalar_mul_fmpz(fmpz_mat_t B, fmpz_mat_t A, fmpz_t c) + void fmpz_mat_scalar_mul_si(fmpz_mat_t B, fmpz_mat_t A, long c) + void fmpz_mat_scalar_mul_ui(fmpz_mat_t B, fmpz_mat_t A, ulong c) + void fmpz_mat_mul(fmpz_mat_t C, fmpz_mat_t A, fmpz_mat_t B) + void fmpz_mat_det(fmpz_t det, fmpz_mat_t A) + long fmpz_mat_rank(fmpz_mat_t A) + long fmpz_mat_rref(fmpz_mat_t R, fmpz_t den, fmpz_mat_t A) + void fmpz_mat_inv(fmpz_mat_t B, fmpz_t den, fmpz_mat_t A) + int fmpz_mat_solve(fmpz_mat_t X, fmpz_t den, fmpz_mat_t A, fmpz_mat_t B) + long fmpz_mat_nullspace(fmpz_mat_t res, fmpz_mat_t mat) + void fmpz_mat_pow(fmpz_mat_t A, fmpz_mat_t B, ulong e) + int fmpz_mat_is_hadamard(const fmpz_mat_t A) + int fmpz_mat_hadamard(fmpz_mat_t A) + + void fmpz_mat_hnf(fmpz_mat_t H, const fmpz_mat_t A) + void fmpz_mat_hnf_transform(fmpz_mat_t H, fmpz_mat_t U, const fmpz_mat_t A) + int fmpz_mat_is_in_hnf(const fmpz_mat_t A) + void fmpz_mat_snf(fmpz_mat_t S, const fmpz_mat_t A) + int fmpz_mat_is_in_snf(const fmpz_mat_t A) + + void fmpz_mat_charpoly(fmpz_poly_t cp, const fmpz_mat_t mat) + void fmpz_mat_minpoly(fmpz_poly_t cp, const fmpz_mat_t mat) diff --git a/src/flint/flintlib/fmpz_mpoly.pxd b/src/flint/flintlib/fmpz_mpoly.pxd new file mode 100644 index 00000000..27f61950 --- /dev/null +++ b/src/flint/flintlib/fmpz_mpoly.pxd @@ -0,0 +1,169 @@ +from flint.flintlib.mpoly cimport mpoly_ctx_t, ordering_t +from flint.flintlib.fmpz cimport fmpz_t, fmpz_struct +from flint._flint cimport ulong, slong, flint_bitcnt_t, flint_rand_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t, fmpz_poly_struct + +cdef extern from "flint/fmpz_mpoly.h": + ctypedef struct fmpz_mpoly_ctx_struct: + mpoly_ctx_t minfo + + ctypedef fmpz_mpoly_ctx_struct fmpz_mpoly_ctx_t[1] + + ctypedef struct fmpz_mpoly_struct: + fmpz_struct * coeffs + ulong * exps + slong alloc + slong length + flint_bitcnt_t bits + + ctypedef fmpz_mpoly_struct fmpz_mpoly_t[1] + + void fmpz_mpoly_ctx_init(fmpz_mpoly_ctx_t ctx, slong nvars, const ordering_t ord) + void fmpz_mpoly_ctx_init_rand(fmpz_mpoly_ctx_t mctx, flint_rand_t state, slong max_nvars) + void fmpz_mpoly_ctx_clear(fmpz_mpoly_ctx_t ctx) + slong fmpz_mpoly_ctx_nvars(const fmpz_mpoly_ctx_t ctx) + ordering_t fmpz_mpoly_ctx_ord(const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_init(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_clear(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + + int fmpz_mpoly_set_str_pretty(fmpz_mpoly_t A, const char * str, const char ** x, const fmpz_mpoly_ctx_t ctx) + char * fmpz_mpoly_get_str_pretty(const fmpz_mpoly_t A, const char ** x, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_gen(fmpz_mpoly_t poly, slong i, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_is_gen(const fmpz_mpoly_t poly, slong k, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_equal(const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_swap(fmpz_mpoly_t A, fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + + slong fmpz_mpoly_max_bits(const fmpz_mpoly_t A) + + int fmpz_mpoly_is_fmpz(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_get_fmpz(fmpz_t c, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_fmpz(fmpz_mpoly_t A, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_ui(fmpz_mpoly_t A, ulong c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_si(fmpz_mpoly_t A, slong c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_zero(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_one(fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_equal_fmpz(const fmpz_mpoly_t A, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_equal_ui(const fmpz_mpoly_t A, ulong c, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_equal_si(const fmpz_mpoly_t A, slong c, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_is_zero(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_is_one(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + + int fmpz_mpoly_degrees_fit_si(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_degrees_fmpz(fmpz_struct ** degs, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_degrees_si(slong * degs, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_degree_fmpz(fmpz_t deg, const fmpz_mpoly_t A, slong var, const fmpz_mpoly_ctx_t ctx) + slong fmpz_mpoly_degree_si(const fmpz_mpoly_t A, slong var, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_total_degree_fits_si(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_total_degree_fmpz(fmpz_t td, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + slong fmpz_mpoly_total_degree_si(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_get_coeff_fmpz_monomial(fmpz_t c, const fmpz_mpoly_t A, const fmpz_mpoly_t M, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_coeff_fmpz_monomial(fmpz_mpoly_t A, const fmpz_t c, const fmpz_mpoly_t M, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_get_coeff_fmpz_fmpz(fmpz_t c, const fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) + ulong fmpz_mpoly_get_coeff_ui_fmpz(const fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) + slong fmpz_mpoly_get_coeff_si_fmpz(const fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_get_coeff_fmpz_ui(fmpz_t c, const fmpz_mpoly_t A, const ulong * exp, const fmpz_mpoly_ctx_t ctx) + ulong fmpz_mpoly_get_coeff_ui_ui(const fmpz_mpoly_t A, const ulong * exp, const fmpz_mpoly_ctx_t ctx) + slong fmpz_mpoly_get_coeff_si_ui(const fmpz_mpoly_t A, + const ulong * exp, const fmpz_mpoly_ctx_t ctx) + void _fmpz_mpoly_set_coeff_fmpz_fmpz(fmpz_mpoly_t A, + const fmpz_t c, const fmpz_struct * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_coeff_fmpz_fmpz(fmpz_mpoly_t A, + const fmpz_t c, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_coeff_ui_fmpz(fmpz_mpoly_t A, + const ulong c, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_coeff_si_fmpz(fmpz_mpoly_t A, + const slong c, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_coeff_fmpz_ui(fmpz_mpoly_t A, + const fmpz_t c, const ulong * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_coeff_ui_ui(fmpz_mpoly_t A, + const ulong c, const ulong * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_set_coeff_si_ui(fmpz_mpoly_t A, + const slong c, const ulong * exp, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_get_coeff_vars_ui(fmpz_mpoly_t C, + const fmpz_mpoly_t A, slong * vars, ulong * exps, slong length, + const fmpz_mpoly_ctx_t ctx) + + int fmpz_mpoly_cmp(const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + + slong fmpz_mpoly_length(const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_get_term_coeff_fmpz(fmpz_t c, const fmpz_mpoly_t A, slong i, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_get_term_exp_fmpz(fmpz_struct ** exp, const fmpz_mpoly_t A, + slong i, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_get_term_exp_ui(ulong * exp, const fmpz_mpoly_t A, + slong i, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_get_term_exp_si(slong * exp, const fmpz_mpoly_t A, + slong i, const fmpz_mpoly_ctx_t ctx) + + ulong fmpz_mpoly_get_term_var_exp_ui(const fmpz_mpoly_t A, slong i, + slong var, const fmpz_mpoly_ctx_t ctx) + + slong fmpz_mpoly_get_term_var_exp_si(const fmpz_mpoly_t A, slong i, + slong var, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_set_term_exp_fmpz(fmpz_mpoly_t A, + slong i, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_set_term_exp_ui(fmpz_mpoly_t A, + slong i, const ulong * exp, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_get_term(fmpz_mpoly_t M, const fmpz_mpoly_t A, + slong i, const fmpz_mpoly_ctx_t ctx) + + void fmpz_mpoly_get_term_monomial(fmpz_mpoly_t M, const fmpz_mpoly_t A, + slong i, const fmpz_mpoly_ctx_t ctx) + + # Addition/Subtraction + void fmpz_mpoly_add_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_add_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_sub_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_sub_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_add(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_t C, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_sub(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_t C, const fmpz_mpoly_ctx_t ctx) + + # Scalar operations + void fmpz_mpoly_neg(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_scalar_mul_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_scalar_mul_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_scalar_mul_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_scalar_divexact_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_scalar_divexact_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_scalar_divexact_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong c, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_scalar_divides_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t c, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_scalar_divides_si(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong c, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_scalar_divides_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong c, const fmpz_mpoly_ctx_t ctx) + + # Differentiation/Integration + void fmpz_mpoly_derivative(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong var, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_integral(fmpz_mpoly_t A, fmpz_t scale, const fmpz_mpoly_t B, slong var, const fmpz_mpoly_ctx_t ctx) + + # Evaluation + int fmpz_mpoly_evaluate_all_fmpz(fmpz_t ev, const fmpz_mpoly_t A, fmpz_struct * const * vals, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_evaluate_one_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, slong var, const fmpz_t val, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_compose_fmpz_poly(fmpz_poly_t A, const fmpz_mpoly_t B, fmpz_poly_struct * const * C, const fmpz_mpoly_ctx_t ctxB) + int fmpz_mpoly_compose_fmpz_mpoly(fmpz_mpoly_t A, const fmpz_mpoly_t B, fmpz_mpoly_struct * const * C, const fmpz_mpoly_ctx_t ctxB, const fmpz_mpoly_ctx_t ctxAC) + void fmpz_mpoly_compose_fmpz_mpoly_gen(fmpz_mpoly_t A, const fmpz_mpoly_t B, const slong * c, const fmpz_mpoly_ctx_t ctxB, const fmpz_mpoly_ctx_t ctxAC) + + # Multiplication + void fmpz_mpoly_mul(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_t C, const fmpz_mpoly_ctx_t ctx) + + # Powering + int fmpz_mpoly_pow_fmpz(fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_t k, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_pow_ui(fmpz_mpoly_t A, const fmpz_mpoly_t B, ulong k, const fmpz_mpoly_ctx_t ctx) + + # Division + int fmpz_mpoly_divides(fmpz_mpoly_t Q, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_divrem(fmpz_mpoly_t Q, fmpz_mpoly_t R, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_quasidivrem(fmpz_t scale, fmpz_mpoly_t Q, fmpz_mpoly_t R, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_div(fmpz_mpoly_t Q, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_quasidiv(fmpz_t scale, fmpz_mpoly_t Q, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_divrem_ideal(fmpz_mpoly_struct ** Q, fmpz_mpoly_t R, const fmpz_mpoly_t A, fmpz_mpoly_struct * const * B, slong len, const fmpz_mpoly_ctx_t ctx) + void fmpz_mpoly_term_content(fmpz_mpoly_t M, const fmpz_mpoly_t A, const fmpz_mpoly_ctx_t ctx) + int fmpz_mpoly_gcd(fmpz_mpoly_t G, const fmpz_mpoly_t A, const fmpz_mpoly_t B, const fmpz_mpoly_ctx_t ctx) diff --git a/src/flint/flintlib/fmpz_poly.pxd b/src/flint/flintlib/fmpz_poly.pxd new file mode 100644 index 00000000..498177b9 --- /dev/null +++ b/src/flint/flintlib/fmpz_poly.pxd @@ -0,0 +1,114 @@ +from flint._flint cimport ulong, mp_limb_t +from flint.flintlib.fmpz cimport fmpz_struct,fmpz_t +from flint.flintlib.nmod_poly cimport nmod_poly_t + +cdef extern from "flint/fmpz_poly.h": + ctypedef struct fmpz_poly_struct: + fmpz_struct * coeffs + long alloc + long length + ctypedef fmpz_poly_struct fmpz_poly_t[1] + + ctypedef struct fmpz_poly_factor_struct: + fmpz_struct c + fmpz_poly_struct *p + long *exp + long num + long alloc + ctypedef fmpz_poly_factor_struct fmpz_poly_factor_t[1] + + void fmpz_poly_init(fmpz_poly_t poly) + void fmpz_poly_init2(fmpz_poly_t poly, long alloc) + void fmpz_poly_realloc(fmpz_poly_t poly, long alloc) + void fmpz_poly_fit_length(fmpz_poly_t poly, long len) + void fmpz_poly_clear(fmpz_poly_t poly) + void _fmpz_poly_normalise(fmpz_poly_t poly) + void _fmpz_poly_set_length(fmpz_poly_t poly, long newlen) + long fmpz_poly_length(fmpz_poly_t poly) + long fmpz_poly_degree(fmpz_poly_t poly) + ulong fmpz_poly_max_limbs(fmpz_poly_t poly) + long fmpz_poly_max_bits(fmpz_poly_t poly) + void fmpz_poly_set(fmpz_poly_t poly1, fmpz_poly_t poly2) + void fmpz_poly_set_ui(fmpz_poly_t poly, ulong c) + void fmpz_poly_set_si(fmpz_poly_t poly, long c) + void fmpz_poly_set_fmpz(fmpz_poly_t poly, fmpz_t c) + #void fmpz_poly_set_mpz(fmpz_poly_t poly, mpz_t c) + int fmpz_poly_set_str(fmpz_poly_t poly, char * str) + char * fmpz_poly_get_str(fmpz_poly_t poly) + char * fmpz_poly_get_str_pretty(fmpz_poly_t poly, char * x) + fmpz_struct * fmpz_poly_get_coeff_ptr(fmpz_poly_t poly, long n) + void fmpz_poly_zero(fmpz_poly_t poly) + void fmpz_poly_one(fmpz_poly_t poly) + void fmpz_poly_zero_coeffs(fmpz_poly_t poly, long i, long j) + void fmpz_poly_swap(fmpz_poly_t poly1, fmpz_poly_t poly2) + void fmpz_poly_reverse(fmpz_poly_t res, fmpz_poly_t poly, long n) + void fmpz_poly_truncate(fmpz_poly_t poly, long newlen) + #void fmpz_poly_randtest(fmpz_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits) + #void fmpz_poly_randtest_unsigned(fmpz_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits) + #void fmpz_poly_randtest_not_zero(fmpz_poly_t f, flint_rand_t state, long len, mp_bitcnt_t bits) + long fmpz_poly_get_coeff_si(fmpz_poly_t poly, long n) + void fmpz_poly_set_coeff_si(fmpz_poly_t poly, long n, long x) + ulong fmpz_poly_get_coeff_ui(fmpz_poly_t poly, long n) + void fmpz_poly_set_coeff_ui(fmpz_poly_t poly, long n, ulong x) + void fmpz_poly_set_coeff_fmpz(fmpz_poly_t poly, long n, fmpz_t x) + void fmpz_poly_get_coeff_fmpz(fmpz_t x, fmpz_poly_t poly, long n) + int fmpz_poly_equal(fmpz_poly_t poly1, fmpz_poly_t poly2) + int fmpz_poly_is_zero(fmpz_poly_t poly) + int fmpz_poly_is_one(fmpz_poly_t op) + int fmpz_poly_is_unit(fmpz_poly_t op) + void fmpz_poly_add(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) + void fmpz_poly_sub(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) + void fmpz_poly_neg(fmpz_poly_t res, fmpz_poly_t poly) + void fmpz_poly_scalar_mul_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) + void fmpz_poly_scalar_mul_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) + void fmpz_poly_scalar_mul_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) + void fmpz_poly_scalar_addmul_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) + void fmpz_poly_scalar_submul_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) + void fmpz_poly_scalar_fdiv_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) + void fmpz_poly_scalar_fdiv_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) + void fmpz_poly_scalar_fdiv_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) + void fmpz_poly_scalar_tdiv_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) + void fmpz_poly_scalar_tdiv_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) + void fmpz_poly_scalar_tdiv_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) + void fmpz_poly_scalar_divexact_ui(fmpz_poly_t poly1, fmpz_poly_t poly2, ulong x) + void fmpz_poly_scalar_divexact_si(fmpz_poly_t poly1, fmpz_poly_t poly2, long x) + void fmpz_poly_scalar_divexact_fmpz(fmpz_poly_t poly1, fmpz_poly_t poly2, fmpz_t x) + void fmpz_poly_mul(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) + void fmpz_poly_mullow(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2, long n) + void fmpz_poly_mulhigh_n(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2, long n) + void fmpz_poly_pow(fmpz_poly_t res, fmpz_poly_t poly, ulong e) + void fmpz_poly_pow_trunc(fmpz_poly_t res, fmpz_poly_t poly, ulong e, long n) + void fmpz_poly_shift_left(fmpz_poly_t res, fmpz_poly_t poly, long n) + void fmpz_poly_shift_right(fmpz_poly_t res, fmpz_poly_t poly, long n) + void fmpz_poly_2norm(fmpz_t res, fmpz_poly_t poly) + void fmpz_poly_gcd(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) + void fmpz_poly_xgcd(fmpz_t r, fmpz_poly_t s, fmpz_poly_t t, fmpz_poly_t poly1, fmpz_poly_t poly2) + void fmpz_poly_content(fmpz_t res, fmpz_poly_t poly) + void fmpz_poly_primitive_part(fmpz_poly_t res, fmpz_poly_t poly) + void fmpz_poly_divrem(fmpz_poly_t Q, fmpz_poly_t R, fmpz_poly_t A, fmpz_poly_t B) + void fmpz_poly_div(fmpz_poly_t Q, fmpz_poly_t A, fmpz_poly_t B) + void fmpz_poly_rem(fmpz_poly_t R, fmpz_poly_t A, fmpz_poly_t B) + fmpz_poly_inv_series(fmpz_poly_t Qinv, fmpz_poly_t Q, long n) + void fmpz_poly_div_series(fmpz_poly_t Q, fmpz_poly_t A, fmpz_poly_t B, long n) + int fmpz_poly_divides(fmpz_poly_t q, fmpz_poly_t a, fmpz_poly_t b) + void fmpz_poly_derivative(fmpz_poly_t res, fmpz_poly_t poly) + void fmpz_poly_evaluate_fmpz(fmpz_t res, fmpz_poly_t f, fmpz_t a) + #void fmpz_poly_evaluate_mpq(mpq_t res, fmpz_poly_t f, mpq_t a) + mp_limb_t fmpz_poly_evaluate_mod(fmpz_poly_t poly, mp_limb_t a, mp_limb_t n) + void fmpz_poly_compose(fmpz_poly_t res, fmpz_poly_t poly1, fmpz_poly_t poly2) + + void fmpz_poly_compose_series(fmpz_poly_t res, const fmpz_poly_t poly1, const fmpz_poly_t poly2, long n) + void fmpz_poly_revert_series(fmpz_poly_t Qinv, const fmpz_poly_t Q, long n) + + void fmpz_poly_signature(long * r1, long * r2, fmpz_poly_t poly) + int fmpz_poly_print(fmpz_poly_t poly) + int fmpz_poly_print_pretty(fmpz_poly_t poly, char * x) + void fmpz_poly_evaluate_fmpz_vec(fmpz_struct * res, fmpz_poly_t f, fmpz_struct * a, long n) + void fmpz_poly_interpolate_fmpz_vec(fmpz_poly_t poly, fmpz_struct * xs, fmpz_struct * ys, long n) + void fmpz_poly_get_nmod_poly(nmod_poly_t res, fmpz_poly_t poly) + void fmpz_poly_set_nmod_poly(fmpz_poly_t res, nmod_poly_t poly) + void fmpz_poly_set_nmod_poly_unsigned(fmpz_poly_t res, nmod_poly_t poly) + void fmpz_poly_cyclotomic(fmpz_poly_t, ulong) + void fmpz_poly_cos_minpoly(fmpz_poly_t, ulong) + void fmpz_poly_swinnerton_dyer(fmpz_poly_t, ulong) + int fmpz_poly_sqrt(fmpz_poly_t b, const fmpz_poly_t a) diff --git a/src/flint/flintlib/fmpz_poly_factor.pxd b/src/flint/flintlib/fmpz_poly_factor.pxd new file mode 100644 index 00000000..ccced4e4 --- /dev/null +++ b/src/flint/flintlib/fmpz_poly_factor.pxd @@ -0,0 +1,8 @@ +from flint.flintlib.fmpz_poly cimport fmpz_poly_t, fmpz_poly_factor_t + +cdef extern from "flint/fmpz_poly_factor.h": + void fmpz_poly_factor_init(fmpz_poly_factor_t fac) + void fmpz_poly_factor_clear(fmpz_poly_factor_t fac) + void fmpz_poly_factor_zassenhaus(fmpz_poly_factor_t fac, fmpz_poly_t G) + void fmpz_poly_factor(fmpz_poly_factor_t fac, fmpz_poly_t G) + void fmpz_poly_factor_squarefree(fmpz_poly_factor_t fac, fmpz_poly_t G) diff --git a/src/flint/flintlib/mag.pxd b/src/flint/flintlib/mag.pxd new file mode 100644 index 00000000..fe25de18 --- /dev/null +++ b/src/flint/flintlib/mag.pxd @@ -0,0 +1,17 @@ +from flint._flint cimport ulong, mp_limb_t +from flint.flintlib.fmpz cimport fmpz_struct + +cdef extern from "mag.h": + ctypedef struct mag_struct: + fmpz_struct exp + mp_limb_t man + ctypedef mag_struct mag_t[1] + ctypedef mag_struct * mag_ptr + ctypedef const mag_struct * mag_srcptr + + void mag_init(mag_t x) + void mag_clear(mag_t x) + void mag_zero(mag_t x) + void mag_set(mag_t x, const mag_t y) + void mag_set_ui_2exp_si(mag_t x, ulong v, long e) + void mag_hypot(mag_t x, const mag_t y, const mag_t z) diff --git a/src/flint/flintlib/mpoly.pxd b/src/flint/flintlib/mpoly.pxd new file mode 100644 index 00000000..e3dabfe6 --- /dev/null +++ b/src/flint/flintlib/mpoly.pxd @@ -0,0 +1,21 @@ +from flint._flint cimport slong, FLINT_BITS + +cdef extern from "flint/mpoly.h": + ctypedef enum ordering_t: + ORD_LEX + ORD_DEGLEX + ORD_DEGREVLEX + + ctypedef struct mpoly_ctx_struct: + slong nvars + slong nfields + ordering_t ord + int deg + int rev + slong lut_words_per_exp[FLINT_BITS] + unsigned char lut_fix_bits[FLINT_BITS] + + ctypedef mpoly_ctx_struct mpoly_ctx_t[1] + + void mpoly_ctx_init(mpoly_ctx_t ctx, slong nvars, const ordering_t ord) + void mpoly_ctx_clear(mpoly_ctx_t mctx) diff --git a/src/flint/flintlib/nmod_mat.pxd b/src/flint/flintlib/nmod_mat.pxd new file mode 100644 index 00000000..aa0a16c4 --- /dev/null +++ b/src/flint/flintlib/nmod_mat.pxd @@ -0,0 +1,53 @@ +from flint._flint cimport mp_limb_t, flint_rand_t, mp_ptr +from flint._flint cimport mp_srcptr +from flint.flintlib.nmod_vec cimport nmod_t +from flint.flintlib.nmod_poly cimport nmod_poly_t + +cdef extern from "flint/nmod_mat.h": + ctypedef struct nmod_mat_struct: + mp_limb_t * entries + long r + long c + mp_limb_t ** rows + nmod_t mod + ctypedef nmod_mat_struct nmod_mat_t[1] + mp_limb_t nmod_mat_entry(nmod_mat_t mat, long i, long j) + long nmod_mat_nrows(nmod_mat_t mat) + long nmod_mat_ncols(nmod_mat_t mat) + void _nmod_mat_set_mod(nmod_mat_t mat, mp_limb_t n) + void nmod_mat_init(nmod_mat_t mat, long rows, long cols, mp_limb_t n) + void nmod_mat_init_set(nmod_mat_t mat, nmod_mat_t src) + void nmod_mat_clear(nmod_mat_t mat) + void nmod_mat_randtest(nmod_mat_t mat, flint_rand_t state) + void nmod_mat_randfull(nmod_mat_t mat, flint_rand_t state) + void nmod_mat_randrank(nmod_mat_t, flint_rand_t state, long rank) + void nmod_mat_randops(nmod_mat_t mat, long count, flint_rand_t state) + void nmod_mat_randtril(nmod_mat_t mat, flint_rand_t state, int unit) + void nmod_mat_randtriu(nmod_mat_t mat, flint_rand_t state, int unit) + void nmod_mat_print_pretty(nmod_mat_t mat) + int nmod_mat_equal(nmod_mat_t mat1, nmod_mat_t mat2) + int nmod_mat_is_zero(nmod_mat_t mat) + int nmod_mat_is_empty(nmod_mat_t mat) + int nmod_mat_is_square(nmod_mat_t mat) + void nmod_mat_zero(nmod_mat_t mat) + void nmod_mat_set(nmod_mat_t B, nmod_mat_t A) + void nmod_mat_transpose(nmod_mat_t B, nmod_mat_t A) + void nmod_mat_add(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) + void nmod_mat_sub(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) + void nmod_mat_neg(nmod_mat_t B, nmod_mat_t A) + void nmod_mat_scalar_mul(nmod_mat_t B, nmod_mat_t A, mp_limb_t c) + void nmod_mat_mul(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) + void nmod_mat_mul_classical(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) + void nmod_mat_mul_strassen(nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) + void nmod_mat_addmul(nmod_mat_t D, nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) + void nmod_mat_submul(nmod_mat_t D, nmod_mat_t C, nmod_mat_t A, nmod_mat_t B) + mp_limb_t nmod_mat_det(nmod_mat_t A) + long nmod_mat_rank(nmod_mat_t A) + int nmod_mat_inv(nmod_mat_t B, nmod_mat_t A) + void nmod_mat_solve_tril(nmod_mat_t X, nmod_mat_t L, nmod_mat_t B, int unit) + void nmod_mat_solve_triu(nmod_mat_t X, nmod_mat_t U, nmod_mat_t B, int unit) + long nmod_mat_lu(long * P, nmod_mat_t A, int rank_check) + int nmod_mat_solve(nmod_mat_t X, nmod_mat_t A, nmod_mat_t B) + int nmod_mat_solve_vec(mp_ptr x, nmod_mat_t A, mp_srcptr b) + long nmod_mat_rref(nmod_mat_t A) + long nmod_mat_nullspace(nmod_mat_t X, nmod_mat_t A) diff --git a/src/flint/flintlib/nmod_poly.pxd b/src/flint/flintlib/nmod_poly.pxd new file mode 100644 index 00000000..acdd779a --- /dev/null +++ b/src/flint/flintlib/nmod_poly.pxd @@ -0,0 +1,85 @@ +from flint._flint cimport mp_ptr, mp_limb_t, mp_bitcnt_t +from flint._flint cimport flint_rand_t, ulong +from flint.flintlib.nmod_vec cimport nmod_t + +cdef extern from "flint/nmod_poly.h": + ctypedef struct nmod_poly_struct: + mp_ptr coeffs + long alloc + long length + nmod_t mod + ctypedef nmod_poly_struct nmod_poly_t[1] + + ctypedef struct nmod_poly_factor_struct: + nmod_poly_struct *p + long *exp + long num + long alloc + ctypedef nmod_poly_factor_struct nmod_poly_factor_t[1] + + void nmod_poly_init(nmod_poly_t poly, mp_limb_t n) + void nmod_poly_init_preinv(nmod_poly_t poly, mp_limb_t n, mp_limb_t ninv) + void nmod_poly_init2(nmod_poly_t poly, mp_limb_t n, long alloc) + void nmod_poly_init2_preinv(nmod_poly_t poly, mp_limb_t n, mp_limb_t ninv, long alloc) + void nmod_poly_realloc(nmod_poly_t poly, long alloc) + void nmod_poly_clear(nmod_poly_t poly) + void nmod_poly_fit_length(nmod_poly_t poly, long alloc) + long nmod_poly_length(nmod_poly_t poly) + long nmod_poly_degree(nmod_poly_t poly) + mp_limb_t nmod_poly_modulus(nmod_poly_t poly) + mp_bitcnt_t nmod_poly_max_bits(nmod_poly_t poly) + void nmod_poly_set(nmod_poly_t a, nmod_poly_t b) + void nmod_poly_swap(nmod_poly_t poly1, nmod_poly_t poly2) + void nmod_poly_zero(nmod_poly_t res) + void nmod_poly_truncate(nmod_poly_t poly, long len) + void nmod_poly_reverse(nmod_poly_t output, nmod_poly_t input, long m) + void nmod_poly_randtest(nmod_poly_t poly, flint_rand_t state, long len) + ulong nmod_poly_get_coeff_ui(nmod_poly_t poly, ulong j) + void nmod_poly_set_coeff_ui(nmod_poly_t poly, ulong j, ulong c) + char * nmod_poly_get_str(nmod_poly_t poly) + int nmod_poly_set_str(char * s, nmod_poly_t poly) + int nmod_poly_print(nmod_poly_t a) + int nmod_poly_equal(nmod_poly_t a, nmod_poly_t b) + int nmod_poly_is_zero(nmod_poly_t poly) + void nmod_poly_shift_left(nmod_poly_t res, nmod_poly_t poly, long k) + void nmod_poly_shift_right(nmod_poly_t res, nmod_poly_t poly, long k) + void nmod_poly_add(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) + void nmod_poly_sub(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) + void nmod_poly_neg(nmod_poly_t res, nmod_poly_t poly1) + void nmod_poly_scalar_mul_nmod(nmod_poly_t res, nmod_poly_t poly1, mp_limb_t c) + void nmod_poly_make_monic(nmod_poly_t output, nmod_poly_t input) + void nmod_poly_mul(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) + void nmod_poly_mullow(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2, long trunc) + void nmod_poly_pow(nmod_poly_t res, nmod_poly_t poly, ulong e) + void nmod_poly_pow_trunc(nmod_poly_t res, nmod_poly_t poly, ulong e, long trunc) + void nmod_poly_divrem(nmod_poly_t Q, nmod_poly_t R, nmod_poly_t A, nmod_poly_t B) + void nmod_poly_div(nmod_poly_t Q, nmod_poly_t A, nmod_poly_t B) + void nmod_poly_inv_series(nmod_poly_t Qinv, nmod_poly_t Q, long n) + void nmod_poly_div_series(nmod_poly_t Q, nmod_poly_t A, nmod_poly_t B, long n) + void nmod_poly_derivative(nmod_poly_t x_prime, nmod_poly_t x) + void nmod_poly_integral(nmod_poly_t x_int, nmod_poly_t x) + mp_limb_t nmod_poly_evaluate_nmod(nmod_poly_t poly, mp_limb_t c) + void nmod_poly_compose(nmod_poly_t res, nmod_poly_t poly1, nmod_poly_t poly2) + void nmod_poly_gcd(nmod_poly_t G, nmod_poly_t A, nmod_poly_t B) + void nmod_poly_xgcd(nmod_poly_t G, nmod_poly_t S, nmod_poly_t T, nmod_poly_t A, nmod_poly_t B) + void nmod_poly_invsqrt_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_sqrt_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_atan_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_tan_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_asin_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_sin_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_cos_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_asinh_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_atanh_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_sinh_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_cosh_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_tanh_series(nmod_poly_t g, nmod_poly_t h, long n) + void nmod_poly_log_series(nmod_poly_t res, nmod_poly_t f, long n) + void nmod_poly_exp_series(nmod_poly_t f, nmod_poly_t h, long n) + + int nmod_poly_is_irreducible(nmod_poly_t f) + mp_limb_t nmod_poly_factor_with_berlekamp(nmod_poly_factor_t result, nmod_poly_t poly) + mp_limb_t nmod_poly_factor_with_cantor_zassenhaus(nmod_poly_factor_t result, nmod_poly_t poly) + mp_limb_t nmod_poly_factor(nmod_poly_factor_t result, nmod_poly_t input) + void nmod_poly_factor_init(nmod_poly_factor_t fac) + void nmod_poly_factor_clear(nmod_poly_factor_t fac) diff --git a/src/flint/flintlib/nmod_vec.pxd b/src/flint/flintlib/nmod_vec.pxd new file mode 100644 index 00000000..9a154a18 --- /dev/null +++ b/src/flint/flintlib/nmod_vec.pxd @@ -0,0 +1,13 @@ +from flint._flint cimport mp_limb_t, mp_bitcnt_t + +cdef extern from "flint/nmod_vec.h": + ctypedef struct nmod_t: + mp_limb_t n + mp_limb_t ninv + mp_bitcnt_t norm + void nmod_init(nmod_t * mod, mp_limb_t n) + mp_limb_t nmod_add(mp_limb_t a, mp_limb_t b, nmod_t mod) + mp_limb_t nmod_sub(mp_limb_t a, mp_limb_t b, nmod_t mod) + mp_limb_t nmod_neg(mp_limb_t a, nmod_t mod) + mp_limb_t nmod_mul(mp_limb_t a, mp_limb_t b, nmod_t mod) + mp_limb_t nmod_div(mp_limb_t a, mp_limb_t b, nmod_t mod) diff --git a/src/flint/flintlib/partitions.pxd b/src/flint/flintlib/partitions.pxd new file mode 100644 index 00000000..ac523b55 --- /dev/null +++ b/src/flint/flintlib/partitions.pxd @@ -0,0 +1,4 @@ +from flint.flintlib.fmpz cimport fmpz_t + +cdef extern from "partitions.h": + void partitions_fmpz_fmpz(fmpz_t, const fmpz_t, int) diff --git a/src/flint/flintlib/ulong_extras.pxd b/src/flint/flintlib/ulong_extras.pxd new file mode 100644 index 00000000..e253dd91 --- /dev/null +++ b/src/flint/flintlib/ulong_extras.pxd @@ -0,0 +1,5 @@ +from flint._flint cimport ulong + +cdef extern from "flint/ulong_extras.h": + ulong n_gcd(ulong n, ulong k) + int n_is_prime(ulong n) diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 7bb8e6a4..4512d5b7 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -1,4 +1,15 @@ from .utils.conversion cimport dps_to_prec +from flint.types.arb_mat cimport arb_mat +from flint.types.acb_mat cimport acb_mat +from flint.types.arb_poly cimport arb_poly +from flint.types.acb_poly cimport acb_poly +from flint.types.arb cimport arb +from flint.types.acb cimport acb +from flint.types.arb_series cimport arb_series +from flint.types.acb_series cimport acb_series +from flint.flintlib.arb cimport * +from flint.flintlib.acb cimport * + # xxx: this doesn't work when changed to a cdef function. why? def __goodness(x, bint parts=True, metric=None): @@ -33,6 +44,7 @@ def good(func, slong prec=0, slong maxprec=0, slong dps=0, a result accurate to the current working precision (or the precision specified by *prec* or *dps*). + >>> from flint import arb >>> good(lambda: (arb.pi() + arb("1e-100")).sin()) Traceback (most recent call last): ... @@ -46,6 +58,7 @@ def good(func, slong prec=0, slong maxprec=0, slong dps=0, that convergence is not possible in case of inexact zeros. This behavior can be overridden by setting *parts* to *False*. + >>> from flint import acb >>> good(lambda: (acb(0,-1) ** 0.5) ** 2) Traceback (most recent call last): ... @@ -107,6 +120,7 @@ def showgood(func, **kwargs): value of the result (without an explicit radius) instead of returning it. + >>> from flint import arb >>> showgood(lambda: arb.pi()) 3.14159265358979 >>> showgood(lambda: arb.pi(), dps=50) diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index abfe739f..d34fb964 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -1,83 +1,16 @@ +from flint.flintlib.arf cimport arf_rnd_t +from flint.flint_base.flint_base cimport flint_mat +from flint.flint_base.flint_base cimport flint_mpoly +from flint.flint_base.flint_base cimport flint_series +from flint.flint_base.flint_base cimport flint_scalar +from flint.flint_base.flint_base cimport flint_poly + +from flint.types.fmpz cimport fmpz from flint._flint cimport * -cdef class Context: - cpdef public bint pretty - cpdef public long prec - cpdef arf_rnd_t rnd - -cdef class fmpz: - cdef fmpz_t val - -cdef class fmpz_poly: - cdef fmpz_poly_t val - -cdef class fmpz_mat: - cdef fmpz_mat_t val - -cdef class fmpz_series: - cdef fmpz_poly_t val - cdef long prec - -cdef class fmpq: - cdef fmpq_t val - -cdef class fmpq_poly: - cdef fmpq_poly_t val - -cdef class fmpq_mat: - cdef fmpq_mat_t val - -cdef class fmpq_series: - cdef fmpq_poly_t val - cdef long prec - -cdef class nmod: - cdef mp_limb_t val - cdef nmod_t mod - -cdef class nmod_poly: - cdef nmod_poly_t val - -cdef class nmod_mat: - cdef nmod_mat_t val - -cdef class nmod_series: - cdef nmod_poly_t val - cdef long prec - -cdef class arf: - cdef arf_t val - -cdef class arb: - cdef arb_t val - -cdef class acb: - cdef acb_t val - -cdef class arb_poly: - cdef arb_poly_t val - -cdef class acb_poly: - cdef acb_poly_t val - -cdef class arb_mat: - cdef arb_mat_t val - -cdef class acb_mat: - cdef acb_mat_t val - -cdef class arb_series: - cdef arb_poly_t val - cdef long prec - -cdef class acb_series: - cdef acb_poly_t val - cdef long prec - -cdef class fmpz_mpoly_ctx: - cdef fmpz_mpoly_ctx_t val - -cdef class fmpz_mpoly: - cdef fmpz_mpoly_t val - cdef bint initialized +cdef flint_rand_t global_random_state +cdef class Context: + cdef public bint pretty + cdef public long prec + cdef arf_rnd_t rnd diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index a9c14ccb..02eea210 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -11,53 +11,6 @@ from flint.flint_base.flint_context cimport thectx cdef flint_rand_t global_random_state flint_randinit(global_random_state) -cdef extern from "Python.h": - int PyObject_TypeCheck(object, PyTypeObject*) - int PyInt_Check(PyObject *o) - PyObject* PyInt_FromLong(long ival) - int PyLong_Check(PyObject *o) - long PyInt_AS_LONG(PyObject *io) - double PyFloat_AS_DOUBLE(PyObject *io) - Py_ssize_t PyList_GET_SIZE(PyObject *list) - long PyLong_AsLongAndOverflow(PyObject *pylong, int *overflow) - int PyComplex_Check(PyObject *o) - double PyComplex_RealAsDouble(PyObject *op) - double PyComplex_ImagAsDouble(PyObject *op) - -DEF FMPZ_UNKNOWN = 0 -DEF FMPZ_REF = 1 -DEF FMPZ_TMP = 2 - ctx = thectx -include "fmpz.pyx" -include "fmpz_poly.pyx" -include "fmpz_mpoly.pyx" -include "fmpz_mat.pyx" -include "fmpz_series.pyx" - -include "fmpq.pyx" -include "fmpq_poly.pyx" -include "fmpq_mat.pyx" -include "fmpq_series.pyx" - -include "nmod.pyx" -include "nmod_poly.pyx" -include "nmod_mat.pyx" -include "nmod_series.pyx" - -include "arf.pyx" -include "arb.pyx" -include "arb_poly.pyx" -include "arb_mat.pyx" -include "arb_series.pyx" - -include "acb.pyx" -include "acb_poly.pyx" -include "acb_mat.pyx" -include "acb_series.pyx" - include "functions.pyx" - -include "dirichlet.pyx" - diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index a90ec10f..dbd15c03 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -51,8 +51,33 @@ def run_tests(verbose=None): def run_doctests(verbose=None): """Run the python-flint doctests""" # Here verbose=True shows a lot of output. - failed, total = doctest.testmod(flint._flint, verbose=verbose) - return failed, total + modules = [flint.pyflint, + flint.types.fmpz, + flint.types.fmpz_poly, + flint.types.fmpz_mat, + flint.types.fmpz_series, + flint.types.fmpq, + flint.types.fmpq_poly, + flint.types.fmpq_mat, + flint.types.fmpq_series, + flint.types.nmod, + flint.types.nmod_poly, + flint.types.nmod_mat, + flint.types.nmod_series, + flint.types.arf, + flint.types.arb, + flint.types.arb_poly, + flint.types.arb_mat, + flint.types.arb_series, + flint.types.acb, + flint.types.acb_poly, + flint.types.acb_mat, + flint.types.acb_series, + flint.types.dirichlet] + results = [doctest.testmod(x) for x in modules] +# ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) + # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) + return tuple(sum(res) for res in zip(*results)) def run_all_tests(tests=True, doctests=True, verbose=None): diff --git a/src/flint/types/__init__.py b/src/flint/types/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/flint/types/acb.pxd b/src/flint/types/acb.pxd new file mode 100644 index 00000000..5c2781f5 --- /dev/null +++ b/src/flint/types/acb.pxd @@ -0,0 +1,11 @@ +from flint.flint_base.flint_base cimport flint_scalar +from flint.flintlib.acb cimport acb_t + +cdef any_as_acb(x) +cdef any_as_acb_or_notimplemented(x) +cdef int acb_set_python(acb_t x, obj, bint allow_conversion) +cdef class acb(flint_scalar): + cdef acb_t val + cpdef bint is_zero(self) + cpdef bint is_finite(self) + cpdef bint is_exact(self) diff --git a/src/flint/acb.pyx b/src/flint/types/acb.pyx similarity index 93% rename from src/flint/acb.pyx rename to src/flint/types/acb.pyx index 7a123bc5..d0d345eb 100644 --- a/src/flint/acb.pyx +++ b/src/flint/types/acb.pyx @@ -1,6 +1,34 @@ +from cpython.complex cimport PyComplex_Check +from cpython.complex cimport PyComplex_RealAsDouble +from cpython.complex cimport PyComplex_ImagAsDouble from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_scalar from flint.flint_base.flint_context cimport getprec +from flint.flint_base.flint_context cimport thectx +from flint.types.arb cimport arb_set_mpmath_mpf +from flint.types.arb cimport arb_set_python +from flint.types.arb cimport any_as_arb +from flint.types.arb cimport arb +from flint.types.fmpz cimport fmpz +from flint.types.fmpz cimport any_as_fmpz +from flint.types.dirichlet cimport dirichlet_char + +from flint._flint cimport FMPZ_TMP, FMPZ_REF, FMPZ_UNKNOWN +from flint.flintlib.mag cimport * +from flint.flintlib.arb cimport * +from flint.flintlib.arf cimport * +from flint.flintlib.acb cimport * +from flint.flintlib.acb_modular cimport * +from flint.flintlib.acb_hypgeom cimport * +from flint.flintlib.acb_dirichlet cimport * +from flint.flintlib.acb_elliptic cimport * +from flint.flintlib.acb_calc cimport * +from flint.flintlib.acb_dft cimport * + +cimport libc.stdlib +cimport cython + +ctx = thectx cdef int acb_set_python(acb_t x, obj, bint allow_conversion): cdef double re, im @@ -13,9 +41,9 @@ cdef int acb_set_python(acb_t x, obj, bint allow_conversion): arb_zero(acb_imagref(x)) return 1 - if PyComplex_Check(obj): - re = PyComplex_RealAsDouble(obj) - im = PyComplex_ImagAsDouble(obj) + if PyComplex_Check(obj): + re = PyComplex_RealAsDouble(obj) + im = PyComplex_ImagAsDouble(obj) arf_set_d(arb_midref(acb_realref(x)), re) arf_set_d(arb_midref(acb_imagref(x)), im) mag_zero(arb_radref(acb_realref(x))) @@ -106,6 +134,7 @@ cdef class acb(flint_scalar): An *acb* represents a complex number by a rectangular enclosure consisting of *arb* balls for the real and imaginary parts. + >>> from flint import fmpq >>> acb(2) 2.00000000000000 >>> acb(2+3j) @@ -116,7 +145,7 @@ cdef class acb(flint_scalar): [0.707106781186547 +/- 6.14e-16] + [0.707106781186547 +/- 6.15e-16]j """ - cdef acb_t val +# cdef acb_t val def __cinit__(self): acb_init(self.val) @@ -322,6 +351,7 @@ cdef class acb(flint_scalar): Complex sign function defined as a piecewise extension of the real sign function. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).csgn(), dps=25) 1.000000000000000000000000 >>> showgood(lambda: acb(-1).csgn(), dps=25) @@ -335,6 +365,7 @@ cdef class acb(flint_scalar): """ Complex sign function. + >>> from flint import showgood >>> showgood(lambda: acb(-1).sgn(), dps=25) -1.000000000000000000000000 >>> showgood(lambda: acb(5,5).sgn(), dps=25) @@ -350,6 +381,7 @@ cdef class acb(flint_scalar): """ Complex argument (phase). + >>> from flint import showgood >>> showgood(lambda: acb("3.3").arg(), dps=25) 0 >>> showgood(lambda: acb(-1).arg(), dps=25) @@ -503,6 +535,7 @@ cdef class acb(flint_scalar): The *analytic* flag allows verifying that the branch cut is not touched; this is useful for numerical integration. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).log(), dps=25) 0.8047189562170501873003797 + 1.107148717794090503017065j >>> showgood(lambda: acb(-5).log(), dps=25) @@ -516,6 +549,7 @@ cdef class acb(flint_scalar): r""" Computes `\log(1+s)`, accurately for small *s*. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).log1p(), dps=25) 1.039720770839917964125848 + 0.7853981633974483096156608j >>> showgood(lambda: acb(0,"1e-100000000000000000").log1p(), dps=25) @@ -529,6 +563,7 @@ cdef class acb(flint_scalar): r""" Inverse sine `\operatorname{asin}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2).asin(), dps=25) 1.570796326794896619231322 - 1.316957896924816708625046j """ @@ -540,6 +575,7 @@ cdef class acb(flint_scalar): r""" Inverse cosine `\operatorname{acos}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2).acos(), dps=25) 1.316957896924816708625046j """ @@ -551,6 +587,7 @@ cdef class acb(flint_scalar): r""" Computes the inverse tangent `\operatorname{atan}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).atan(), dps=25) 1.338972522294493561124194 + 0.4023594781085250936501898j """ @@ -562,6 +599,7 @@ cdef class acb(flint_scalar): r""" Inverse hyperbolic sine `\operatorname{asinh}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).asinh(), dps=25) 1.968637925793096291788665 + 0.9646585044076027920454111j """ @@ -573,6 +611,7 @@ cdef class acb(flint_scalar): r""" Inverse hyperbolic cosine `\operatorname{acosh}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).acosh(), dps=25) 1.983387029916535432347077 + 1.000143542473797218521038j """ @@ -584,6 +623,7 @@ cdef class acb(flint_scalar): r""" Inverse hyperbolic tangent `\operatorname{atanh}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).atanh(), dps=25) 0.1469466662255297520474328 + 1.338972522294493561124194j """ @@ -596,6 +636,7 @@ cdef class acb(flint_scalar): Arithmetic-geometric mean `M(s,t)`, or `M(s) = M(s,1)` if no extra parameter is passed. + >>> from flint import showgood >>> showgood(lambda: acb(2).agm(), dps=25) 1.456791031046906869186432 >>> showgood(lambda: acb(1,1).agm(), dps=25) @@ -617,6 +658,7 @@ cdef class acb(flint_scalar): """ Gamma function `\Gamma(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).gamma(), dps=25) 0.1519040026700361374481610 + 0.01980488016185498197191013j """ @@ -629,6 +671,7 @@ cdef class acb(flint_scalar): Reciprocal gamma function `1/\Gamma(s)`, avoiding division by zero at the poles of the gamma function. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).rgamma(), dps=25) 6.473073626019134501563613 - 0.8439438407732021454882999j >>> print(acb(0).rgamma()) @@ -646,6 +689,8 @@ cdef class acb(flint_scalar): The function is defined to be continuous away from the negative half-axis and thus differs from `\log(\Gamma(s))` in general. + >>> from flint import arb + >>> from flint import showgood >>> showgood(lambda: acb(1,2).lgamma(), dps=25) -1.876078786430929341229996 + 0.1296463163097883113837075j >>> showgood(lambda: (acb(0,10).lgamma() - acb(0,10).gamma().log()).imag / arb.pi(), dps=25) @@ -659,6 +704,7 @@ cdef class acb(flint_scalar): """ Digamma function `\psi(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).digamma(), dps=25) 0.7145915153739775266568699 + 1.320807282642230228386088j """ @@ -671,6 +717,7 @@ cdef class acb(flint_scalar): Riemann zeta function `\zeta(s)`, or the Hurwitz zeta function `\zeta(s,a)` if a second parameter is passed. + >>> from flint import showgood >>> showgood(lambda: acb(0.5,1000).zeta(), dps=25) 0.3563343671943960550744025 + 0.9319978312329936651150604j >>> showgood(lambda: acb(1,2).zeta(acb(2,3)), dps=25) @@ -701,6 +748,7 @@ cdef class acb(flint_scalar): """ Returns tthe constant `\pi` as an *acb*. + >>> from flint import showgood >>> showgood(lambda: acb.pi(), dps=25) 3.141592653589793238462643 """ @@ -712,12 +760,14 @@ cdef class acb(flint_scalar): r""" Square root `\sqrt{s}`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).sqrt(), dps=25) 1.272019649514068964252422 + 0.7861513777574232860695586j The *analytic* flag allows verifying that the branch cut is not touched; this is useful for numerical integration. + >>> from flint import showgood >>> showgood(lambda: acb.integral(lambda z, a: z.sqrt(), 0, 1).real, dps=25) # WRONG!!! 0.6738873386790491615691993 >>> showgood(lambda: acb.integral(lambda z, a: z.sqrt(analytic=a), 0, 1).real, dps=25) @@ -734,6 +784,7 @@ cdef class acb(flint_scalar): The *analytic* flag allows verifying that the branch cut is not touched; this is useful for numerical integration. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).rsqrt(), dps=25) 0.5688644810057831072783079 - 0.3515775842541429284870573j """ @@ -745,6 +796,7 @@ cdef class acb(flint_scalar): r""" Exponential function `\exp(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).exp(), dps=25) -1.131204383756813638431255 + 2.471726672004818927616931j """ @@ -756,6 +808,7 @@ cdef class acb(flint_scalar): r""" Exponential function of modified argument `\exp(\pi i s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).exp_pi_i(), dps=25) -0.001867442731707988814430213 >>> showgood(lambda: acb(1.5,2.5).exp_pi_i(), dps=25) @@ -771,6 +824,7 @@ cdef class acb(flint_scalar): r""" Exponential function `\exp(s)-1`, computed accurately for small *s*. + >>> from flint import showgood >>> showgood(lambda: acb("1e-10000").expm1(), dps=25) 1.000000000000000000000000e-10000 """ @@ -782,6 +836,7 @@ cdef class acb(flint_scalar): r""" Sine function `\sin(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).sin(), dps=25) 3.165778513216168146740735 + 1.959601041421605897070352j """ @@ -793,6 +848,7 @@ cdef class acb(flint_scalar): r""" Cosine function `\cos(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).cos(), dps=25) 2.032723007019665529436343 - 3.051897799151800057512116j """ @@ -804,6 +860,7 @@ cdef class acb(flint_scalar): r""" Computes `\sin(s)` and `\cos(s)` simultaneously. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).sin_cos(), dps=15) (3.16577851321617 + 1.95960104142161j, 2.03272300701967 - 3.05189779915180j) """ @@ -816,6 +873,7 @@ cdef class acb(flint_scalar): r""" Tangent function `\tan(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).tan(), dps=25) 0.03381282607989669028437056 + 1.014793616146633568117054j """ @@ -827,6 +885,7 @@ cdef class acb(flint_scalar): r""" Cotangent function `\cot(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).cot(), dps=25) 0.03279775553375259406276455 - 0.9843292264581910294718882j """ @@ -838,6 +897,7 @@ cdef class acb(flint_scalar): r""" Sine function `\sin(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).sin_pi(), dps=25) -267.7448940410165142571174j """ @@ -849,6 +909,7 @@ cdef class acb(flint_scalar): r""" Cosine function `\cos(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).cos_pi(), dps=25) -267.7467614837482222459319 """ @@ -860,6 +921,7 @@ cdef class acb(flint_scalar): r""" Computes `\sin(\pi s)` and `\cos(\pi s)` simultaneously. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).sin_cos_pi(), dps=25) (-267.7448940410165142571174j, -267.7467614837482222459319) """ @@ -872,6 +934,7 @@ cdef class acb(flint_scalar): r""" Tangent function `\tan(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).tan_pi(), dps=25) 0.9999930253396106106051072j """ @@ -883,6 +946,7 @@ cdef class acb(flint_scalar): r""" Cotangent function `\cot(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).cot_pi(), dps=25) -1.000006974709035616233122j """ @@ -894,6 +958,7 @@ cdef class acb(flint_scalar): r""" Secant function `\sec(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).sec(), dps=25) -0.04167496441114427004834991 + 0.09061113719623759652966120j """ @@ -905,6 +970,7 @@ cdef class acb(flint_scalar): r""" Cosecant function `\sec(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).csc(), dps=25) 0.09047320975320743980579048 + 0.04120098628857412646300981j """ @@ -916,6 +982,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic sine function `\sinh(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).sinh(), dps=25) -3.590564589985779952012565 + 0.5309210862485198052670401j """ @@ -927,6 +994,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic cosine function `\cosh(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).cosh(), dps=25) -3.724545504915322565473971 + 0.5118225699873846088344638j """ @@ -938,6 +1006,7 @@ cdef class acb(flint_scalar): r""" Computes `\sinh(s)` and `\cosh(s)` simultaneously. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).sinh_cosh(), dps=15) (-0.489056259041294 + 1.40311925062204j, -0.642148124715520 + 1.06860742138278j) """ @@ -950,6 +1019,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic tangent function `\tanh(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).tanh(), dps=25) 0.9653858790221331242784803 - 0.009884375038322493720314034j """ @@ -961,6 +1031,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic cotangent function `\coth(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).coth(), dps=25) 1.035746637764995396112759 + 0.01060478347033710175031690j """ @@ -972,6 +1043,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic secant function `\operatorname{sech}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).sech(), dps=25) -0.2635129751583893096436042 - 0.03621163655876852087145690j """ @@ -983,6 +1055,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic cosecant function `\operatorname{csch}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).csch(), dps=25) -0.2725486614629401995124985 - 0.04030057885689152187513248j """ @@ -994,6 +1067,7 @@ cdef class acb(flint_scalar): r""" Sinc function, `\operatorname{sinc}(x) = \sin(x)/x`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).sinc(), dps=25) 0.4463290318402435457438585 - 2.753947027743647493993194j """ @@ -1005,6 +1079,7 @@ cdef class acb(flint_scalar): r""" Normalized sinc function, `\operatorname{sinc}(\pi x) = \sin(\pi x)/(\pi x)`. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).sinc_pi(), dps=25) 455.1212281938610260024088 + 303.4141521292406840016059j """ @@ -1016,6 +1091,7 @@ cdef class acb(flint_scalar): """ Rising factorial `(s)_n`. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).rising(5), dps=25) -540.0000000000000000000000 - 100.0000000000000000000000j >>> showgood(lambda: acb(1,2).rising(2+3j), dps=25) @@ -1033,6 +1109,7 @@ cdef class acb(flint_scalar): The current implementation does not use the gamma function, so *n* should be moderate. + >>> from flint import showgood >>> showgood(lambda: acb(1,2).rising2(5), dps=25) (-540.0000000000000000000000 - 100.0000000000000000000000j, -666.0000000000000000000000 + 420.0000000000000000000000j) """ @@ -1047,6 +1124,7 @@ cdef class acb(flint_scalar): the argument *z* is given by *self* and the order *s* is given as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: acb(3).polylog(2), dps=25) 2.320180423313098396406194 - 3.451392295223202661433821j >>> showgood(lambda: acb(2,3).polylog(1+2j), dps=25) @@ -1061,6 +1139,7 @@ cdef class acb(flint_scalar): r""" Error function `\operatorname{erf}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(2+3j).erf() - 1, dps=25) -21.82946142761456838910309 + 8.687318271470163144428079j >>> showgood(lambda: acb("77.7").erf() - 1, dps=25, maxdps=10000) @@ -1079,6 +1158,7 @@ cdef class acb(flint_scalar): for example `\theta_3(z,\tau) = 1 + 2 \sum_{n=1}^{\infty} q^{n^2} \cos(2n\pi z)`. + >>> from flint import showgood >>> for i in range(4): ... showgood(lambda: acb(1+1j).modular_theta(1.25+3j)[i], dps=25) ... @@ -1124,6 +1204,7 @@ cdef class acb(flint_scalar): r""" Dedekind eta function `\eta(\tau)`. + >>> from flint import showgood >>> showgood(lambda: acb(1+1j).modular_eta(), dps=25) 0.7420487758365647263392722 + 0.1988313702299107190516142j """ @@ -1135,6 +1216,7 @@ cdef class acb(flint_scalar): r""" Modular *j*-invariant `j(\tau)`. + >>> from flint import showgood >>> showgood(lambda: (1 + acb(-163).sqrt()/2).modular_j(), dps=25) 262537412640769488.0000000 >>> showgood(lambda: acb(3.25+100j).modular_j() - 744, dps=25, maxdps=2000) @@ -1148,6 +1230,7 @@ cdef class acb(flint_scalar): r""" Modular lambda function `\lambda(\tau)`. + >>> from flint import showgood >>> showgood(lambda: acb(0.25+5j).modular_lambda(), dps=25) 1.704995415668039343330405e-6 + 1.704992508662079437786598e-6j """ @@ -1159,6 +1242,7 @@ cdef class acb(flint_scalar): r""" Modular discriminant `\Delta(\tau)`. + >>> from flint import showgood >>> showgood(lambda: acb(0.25+5j).modular_delta(), dps=25) 1.237896015010281684100435e-26 + 2.271101068324093838679275e-14j """ @@ -1170,6 +1254,7 @@ cdef class acb(flint_scalar): """ Complete elliptic integral of the first kind `K(m)`. + >>> from flint import showgood >>> showgood(lambda: 2 * acb(0).elliptic_k(), dps=25) 3.141592653589793238462643 >>> showgood(lambda: acb(100+50j).elliptic_k(), dps=25) @@ -1184,6 +1269,7 @@ cdef class acb(flint_scalar): def elliptic_e(m): """ Complete elliptic integral of the second kind `E(m)`. + >>> from flint import showgood >>> showgood(lambda: 2 * acb(0).elliptic_e(), dps=25) 3.141592653589793238462643 >>> showgood(lambda: acb(100+50j).elliptic_e(), dps=25) @@ -1223,6 +1309,7 @@ cdef class acb(flint_scalar): is given by *self* and the order *s* is passed as an extra parameter. Optionally the regularized version `Q(s,z)` can be computed. + >>> from flint import showgood >>> showgood(lambda: acb(2+3j).gamma_upper(1+2j), dps=25) 0.02614303924198793235765248 - 0.0007536537278463329391666679j >>> showgood(lambda: acb(2+3j).gamma_upper(1+2j, regularized=True), dps=25) @@ -1240,6 +1327,7 @@ cdef class acb(flint_scalar): Optionally the regularized versions `P(s,z)` and `\gamma^{*}(s,z) = z^{-s} P(s,z)` can be computed. + >>> from flint import showgood >>> showgood(lambda: acb(2+3j).gamma_lower(2.5), dps=25) 1.646077010134876664349297 + 1.140585862703100904414519j >>> showgood(lambda: acb(2+3j).gamma_lower(2.5, regularized=1), dps=25) @@ -1259,6 +1347,7 @@ cdef class acb(flint_scalar): as extra function arguments. Optionally the regularized version of this function can be computed. + >>> from flint import showgood >>> showgood(lambda: acb(2,3).beta_lower(1, 2.5), dps=25) 0.2650137734913866999568502 - 7.111836702381954625752124j >>> showgood(lambda: acb(2,3).beta_lower(1, 2.5, regularized=True), dps=25) @@ -1275,6 +1364,7 @@ cdef class acb(flint_scalar): Generalized exponential integral `E_s(z)`. The argument *z* is given by *self* and the order *s* is passed as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: acb(2+3j).expint(1+2j), dps=25) -0.01442661495527080336037156 + 0.01942348372986687164972794j """ @@ -1287,6 +1377,7 @@ cdef class acb(flint_scalar): r""" Complementary error function `\operatorname{erfc}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb("77.7").erfc(), dps=25) 7.929310690520378873143053e-2625 """ @@ -1298,6 +1389,7 @@ cdef class acb(flint_scalar): r""" Imaginary error function `\operatorname{erfi}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(10).erfi(), dps=25) 1.524307422708669699360547e+42 """ @@ -1312,6 +1404,7 @@ cdef class acb(flint_scalar): r""" Exponential integral `\operatorname{Ei}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(10).ei(), dps=25) 2492.228976241877759138440 """ @@ -1323,6 +1416,7 @@ cdef class acb(flint_scalar): r""" Sine integral `\operatorname{Si}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(10).si(), dps=25) 1.658347594218874049330972 """ @@ -1334,6 +1428,7 @@ cdef class acb(flint_scalar): r""" Cosine integral `\operatorname{Ci}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(10).ci(), dps=25) -0.04545643300445537263453283 """ @@ -1345,6 +1440,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic sine integral `\operatorname{Shi}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(10).shi(), dps=25) 1246.114490199423344411882 """ @@ -1356,6 +1452,7 @@ cdef class acb(flint_scalar): r""" Hyperbolic cosine integral `\operatorname{Chi}(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(10).chi(), dps=25) 1246.114486042454414726558 """ @@ -1369,6 +1466,7 @@ cdef class acb(flint_scalar): the offset logarithmic integral `\operatorname{Li}(s) = \operatorname{li}(s) - \operatorname{li}(2)`. + >>> from flint import showgood >>> showgood(lambda: acb(10).li(), dps=25) 6.165599504787297937522982 >>> showgood(lambda: acb(10).li(offset=True), dps=25) @@ -1384,6 +1482,7 @@ cdef class acb(flint_scalar): is given by *self* Optionally the regularized version of this function can be computed. + >>> from flint import showgood >>> showgood(lambda: acb(5).hypgeom_2f1(1,2,3), dps=25) -0.5109035488895912495067571 - 0.2513274122871834590770115j >>> showgood(lambda: acb(5).hypgeom_2f1(1,2,3,regularized=True), dps=25) @@ -1394,6 +1493,8 @@ cdef class acb(flint_scalar): exact integers, even if the input intervals are inexact. If the parameters are exact, these flags are not needed. + >>> from flint import arb + >>> from flint import showgood >>> showgood(lambda: acb("11/10").hypgeom_2f1(arb(2).sqrt(), 0.5, arb(2).sqrt()+1.5, abc=True), dps=25) 1.801782659480054173351004 - 0.3114019850045849100659641j >>> showgood(lambda: acb("11/10").hypgeom_2f1(arb(2).sqrt(), 0.5, arb(2).sqrt()+1.5), dps=25) @@ -1420,6 +1521,7 @@ cdef class acb(flint_scalar): r""" Chebyshev function of the first kind `T_n(s)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).chebyshev_t(3), dps=25) -0.8518518518518518518518519 """ @@ -1432,6 +1534,7 @@ cdef class acb(flint_scalar): r""" Chebyshev function of the second kind `U_n(s)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).chebyshev_u(3), dps=25) -1.037037037037037037037037 """ @@ -1444,6 +1547,7 @@ cdef class acb(flint_scalar): r""" Jacobi polynomial (or Jacobi function) `P_n^{a,b}(s)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).jacobi_p(5, 0.25, 0.5), dps=25) 0.4131944444444444444444444 """ @@ -1458,6 +1562,7 @@ cdef class acb(flint_scalar): r""" Gegenbauer function `C_n^{m}(s)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).gegenbauer_c(5, 0.25), dps=25) 0.1321855709876543209876543 """ @@ -1471,6 +1576,7 @@ cdef class acb(flint_scalar): r""" Laguerre function `L_n^{m}(s)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).laguerre_l(5, 0.25), dps=25) 0.03871323490012002743484225 """ @@ -1484,6 +1590,7 @@ cdef class acb(flint_scalar): r""" Hermite function `H_n(s)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).hermite_h(5), dps=25) 34.20576131687242798353909 """ @@ -1496,6 +1603,7 @@ cdef class acb(flint_scalar): r""" Legendre function of the first kind `P_n^m(z)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).legendre_p(5), dps=25) 0.3333333333333333333333333 >>> showgood(lambda: (acb(1)/3).legendre_p(5, 1.5), dps=25) @@ -1521,6 +1629,7 @@ cdef class acb(flint_scalar): r""" Legendre function of the second kind `Q_n^m(z)`. + >>> from flint import showgood >>> showgood(lambda: (acb(1)/3).legendre_q(5), dps=25) 0.1655245300933242182362054 >>> showgood(lambda: (acb(1)/3).legendre_q(5, 1.5), dps=25) @@ -1548,6 +1657,7 @@ cdef class acb(flint_scalar): Spherical harmonic `Y_n^m(\theta, \phi)`. The present implementation only supports integer *n* and *m*. + >>> from flint import showgood >>> showgood(lambda: acb.spherical_y(5, 3, 0.25, 0.75), dps=25) 0.02451377199072374024317003 - 0.03036343496553117039110087j """ @@ -1562,6 +1672,7 @@ cdef class acb(flint_scalar): Airy function `\operatorname{Ai}(s)`, or `\operatorname{Ai}'(s)` if *derivative* is 1. + >>> from flint import showgood >>> showgood(lambda: acb(-1+1j).airy_ai(), dps=25) 0.8221174265552725939610246 - 0.1199663426644243438939006j >>> showgood(lambda: acb(-1+1j).airy_ai(derivative=1), dps=25) @@ -1581,6 +1692,7 @@ cdef class acb(flint_scalar): Airy function `\operatorname{Bi}(s)`, or `\operatorname{Bi}'(s)` if *derivative* is 1. + >>> from flint import showgood >>> showgood(lambda: acb(-1+1j).airy_bi(), dps=25) 0.2142904015348735739780868 + 0.6739169237227052095951775j >>> showgood(lambda: acb(-1+1j).airy_bi(derivative=1), dps=25) @@ -1601,6 +1713,7 @@ cdef class acb(flint_scalar): `\operatorname{Ai}'(s)`, `\operatorname{Bi}(s)`, `\operatorname{Bi}'(s)` simultaneously, returning a tuple. + >>> from flint import showgood >>> showgood(lambda: acb(-1+1j).airy(), dps=5) (0.82212 - 0.11997j, -0.37906 - 0.60450j, 0.21429 + 0.67392j, 0.83447 - 0.34653j) """ @@ -1616,6 +1729,7 @@ cdef class acb(flint_scalar): r""" Lambert *W* function, `W_k(s)` where *k* is given by *branch*. + >>> from flint import showgood >>> showgood(lambda: acb(1).lambertw(), dps=25) 0.5671432904097838729999687 >>> showgood(lambda: acb(1).lambertw(-1), dps=25) @@ -1673,6 +1787,7 @@ cdef class acb(flint_scalar): analytic function. This function is useful for integration. >>> f = lambda z, a: (z**3).real_abs(analytic=a) + >>> from flint import showgood >>> showgood(lambda: acb.integral(f, -1, 1), dps=25) 0.5000000000000000000000000 """ @@ -1719,6 +1834,7 @@ cdef class acb(flint_scalar): Floor function of a real variable, extended to a piecewise complex analytic function. This function is useful for integration. + >>> from flint import showgood >>> showgood(lambda: acb.integral(lambda x, a: x.real_floor(analytic=a), 0, 100), dps=15) 4950.00000000000 """ @@ -1731,6 +1847,7 @@ cdef class acb(flint_scalar): Ceiling function of a real variable, extended to a piecewise complex analytic function. This function is useful for integration. + >>> from flint import showgood >>> showgood(lambda: acb.integral(lambda x, a: x.real_ceil(analytic=a), 0, 100), dps=15) 5050.00000000000 """ @@ -1744,6 +1861,7 @@ cdef class acb(flint_scalar): analytic function. This function is useful for integration. >>> f = lambda x, a: x.sin().real_max(x.cos(), analytic=a) + >>> from flint import showgood >>> showgood(lambda: acb.integral(f, 0, acb.pi())) 2.41421356237310 """ @@ -1757,6 +1875,7 @@ cdef class acb(flint_scalar): analytic function. This function is useful for integration. >>> f = lambda x, a: x.sin().real_min(x.cos(), analytic=a) + >>> from flint import showgood >>> showgood(lambda: acb.integral(f, 0, acb.pi())) -0.414213562373095 """ @@ -1784,6 +1903,7 @@ cdef class acb(flint_scalar): r""" Generalized Stieltjes constant `\gamma_n(a)`. + >>> from flint import showgood >>> showgood(lambda: acb.stieltjes(1), dps=25) -0.07281584548367672486058638 >>> showgood(lambda: acb.stieltjes(10**10), dps=25) @@ -1804,6 +1924,7 @@ cdef class acb(flint_scalar): """ Returns the value of the Bernoulli polynomial `B_n(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(0.25+0.25j).bernoulli_poly(5), dps=25) -0.05859375000000000000000000 + 0.006510416666666666666666667j """ @@ -1859,6 +1980,7 @@ cdef class acb(flint_scalar): r""" Fresnel sine integral `S(s)`, optionally not normalized. + >>> from flint import showgood >>> showgood(lambda: acb(3).fresnel_s(), dps=25) 0.4963129989673750360976123 >>> showgood(lambda: acb(3).fresnel_s(normalized=False), dps=25) @@ -1872,6 +1994,7 @@ cdef class acb(flint_scalar): r""" Fresnel cosine integral `C(s)`, optionally not normalized. + >>> from flint import showgood >>> showgood(lambda: acb(3).fresnel_c(), dps=25) 0.6057207892976856295561611 >>> showgood(lambda: acb(3).fresnel_c(normalized=False), dps=25) @@ -1886,6 +2009,7 @@ cdef class acb(flint_scalar): Logarithmic sine function with analytic continuation defined to be consistent with the functional equation of the log gamma function. + >>> from flint import showgood >>> showgood(lambda: acb(5+2j).log_sin_pi(), dps=25) 5.590034639271204166020651 - 14.13716694115406957308190j >>> showgood(lambda: acb(5+2j).sin_pi().log(), dps=25) @@ -1900,6 +2024,7 @@ cdef class acb(flint_scalar): r""" Carlson incomplete elliptic integral `R_F(x,y,z)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_rf(1, 2+3j, 3+4j), dps=25) 0.5577655465453921610327459 - 0.2202042457195556054465308j """ @@ -1915,6 +2040,7 @@ cdef class acb(flint_scalar): r""" Carlson incomplete elliptic integral `R_C(x,y)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_rc(1, 2+3j), dps=25) 0.5952169239306156198937085 - 0.2387981909090509407085918j """ @@ -1929,6 +2055,7 @@ cdef class acb(flint_scalar): r""" Carlson incomplete elliptic integral `R_J(x,y,z,p)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_rj(1, 2, 1+2j, 2+3j), dps=25) 0.1604659632144333057202530 - 0.2502751672723324201692394j """ @@ -1945,6 +2072,7 @@ cdef class acb(flint_scalar): r""" Carlson incomplete elliptic integral `R_D(x,y,z)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_rd(1, 2, 1+2j), dps=25) 0.2043722510302629773408686 - 0.3559745898273715996616328j """ @@ -1960,6 +2088,7 @@ cdef class acb(flint_scalar): r""" Carlson incomplete elliptic integral `R_G(x,y,z)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_rg(1, 2, 1+2j), dps=25) 1.206557168056722980475052 + 0.2752176688707739710008275j """ @@ -1975,6 +2104,7 @@ cdef class acb(flint_scalar): r""" Incomplete elliptic integral `F(\phi,m)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_f(2, 0.75), dps=25) 2.952569673655779502336268 >>> showgood(lambda: acb.elliptic_f(2, 0.75, pi=True), dps=25) @@ -1991,6 +2121,7 @@ cdef class acb(flint_scalar): r""" Incomplete elliptic integral `E(\phi,m)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_e_inc(2, 0.75), dps=25) 1.443433069099461566497882 >>> showgood(lambda: acb.elliptic_e_inc(2, 0.75, pi=True), dps=25) @@ -2007,6 +2138,7 @@ cdef class acb(flint_scalar): r""" Complete elliptic integral `\Pi(n,m)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_pi(0.25, 0.125), dps=25) 1.879349451879603826415650 """ @@ -2021,6 +2153,7 @@ cdef class acb(flint_scalar): r""" Incomplete elliptic integral `\Pi(n,\phi,m)`. + >>> from flint import showgood >>> showgood(lambda: acb.elliptic_pi_inc(0.25, 0.5, 0.125), dps=25) 0.5128718023282086251399279 >>> showgood(lambda: acb.elliptic_pi_inc(0.25, 0.5, 0.125, pi=True), dps=25) @@ -2037,6 +2170,7 @@ cdef class acb(flint_scalar): r""" Weierstrass elliptic function `\wp(z, \tau)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: acb("1/3","1/5").elliptic_p(1j), dps=25) 3.686380646078879780287811 - 4.591498371497259422829963j >>> showgood(lambda: acb("1/3","6/5").elliptic_p(1j), dps=25) @@ -2051,6 +2185,7 @@ cdef class acb(flint_scalar): r""" Weierstrass elliptic function `\zeta(z, \tau)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: acb("1/3","1/5").elliptic_zeta(1j), dps=25) 2.219680339508418716159086 - 1.504947925755241700681002j """ @@ -2063,6 +2198,7 @@ cdef class acb(flint_scalar): r""" Weierstrass elliptic function `\sigma(z, \tau)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: acb("1/3","1/5").elliptic_sigma(1j), dps=25) 0.3396549497136886526515370 + 0.1970690762350931272896772j """ @@ -2076,6 +2212,7 @@ cdef class acb(flint_scalar): Inverse Weierstrass elliptic function `\sigma^{-1}(z, \tau)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: acb("1/3","1/5").elliptic_p(1j).elliptic_inv_p(1j), dps=25) 0.3333333333333333333333333 + 0.2000000000000000000000000j """ @@ -2089,6 +2226,7 @@ cdef class acb(flint_scalar): Returns the elliptic roots `e_1, e_2, e_3` given the lattice parameter `\tau`. + >>> from flint import showgood >>> showgood(lambda: acb(0.5+1j).elliptic_roots(), dps=10) (6.285388119, -3.142694059 + 3.386618325j, -3.142694059 - 3.386618325j) """ @@ -2103,6 +2241,7 @@ cdef class acb(flint_scalar): Returns the lattice invariants `g_2, g_3` given the lattice parameter `\tau`. + >>> from flint import showgood >>> showgood(lambda: acb(0.5+1j).elliptic_invariants(), dps=25) (72.64157667926127619414883, 536.6642788346023116199232) """ @@ -2115,6 +2254,7 @@ cdef class acb(flint_scalar): r""" Dirichlet eta function `\eta(s)`. + >>> from flint import showgood >>> showgood(lambda: acb(1).dirichlet_eta(), dps=25) 0.6931471805599453094172321 >>> showgood(lambda: acb(0).dirichlet_eta(), dps=25) @@ -2130,6 +2270,7 @@ cdef class acb(flint_scalar): r""" Polygamma function `\psi_s(z)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: acb(2+3j).polygamma(2), dps=25) 0.05267618908093586035755719 + 0.07303622933440580692454450j """ @@ -2143,6 +2284,7 @@ cdef class acb(flint_scalar): Logarithmic Barnes G-function `\log G(s)`. Like the logarithmic gamma function, continuous analytic continuation is implied. + >>> from flint import showgood >>> showgood(lambda: acb(2+3j).log_barnes_g(), dps=25) -1.694395396880976849503750 - 3.389316783507118550918827j >>> showgood(lambda: acb(2+3j).barnes_g().log(), dps=25) @@ -2158,6 +2300,7 @@ cdef class acb(flint_scalar): >>> acb(8).barnes_g() 24883200.0000000 + >>> from flint import showgood >>> showgood(lambda: acb(2+3j).barnes_g(), dps=25) -0.1781021386408216960641890 + 0.04504542715447837909120582j """ @@ -2171,6 +2314,7 @@ cdef class acb(flint_scalar): is given by *self* Optionally the regularized version of this function can be computed. + >>> from flint import showgood >>> showgood(lambda: acb(-5).hypgeom_0f1(2.5), dps=25) 0.003114611044402738470826907 >>> showgood(lambda: acb(-5).hypgeom_0f1(2.5, regularized=True), dps=25) @@ -2189,6 +2333,8 @@ cdef class acb(flint_scalar): Optionally the regularized hypergeometric function can be computed. + >>> from flint import fmpq + >>> from flint import showgood >>> showgood(lambda: acb.pi().hypgeom([1+1j, 2-2j], [3, fmpq(1,3)]), dps=25) # 2F2 144.9760711583421645394627 - 51.06535684838559608699106j >>> showgood(lambda: acb.pi().hypgeom([1+1j, 2-2j], [3, fmpq(1,3)], regularized=True), dps=25) @@ -2234,6 +2380,7 @@ cdef class acb(flint_scalar): of terms to add in the asymptotic series. This is just a tuning parameter: a rigorous error bound is computed regardless of *n*. + >>> from flint import showgood >>> showgood(lambda: acb(400+500j).hypgeom_u(1+1j, 2+3j), dps=25) 0.001836433961463105354717547 - 0.003358699641979853540147122j >>> showgood(lambda: acb(-30).hypgeom_u(1+1j, 2+3j), dps=25) @@ -2263,6 +2410,7 @@ cdef class acb(flint_scalar): where *z* is given by *self*.. Optionally, computes the regularized version. + >>> from flint import showgood >>> showgood(lambda: acb(40000+50000j).hypgeom_1f1(2+3j, 3+4j), dps=25) 3.730925582634533963357515e+17366 + 3.199717318207534638202987e+17367j >>> showgood(lambda: acb(40000+50000j).hypgeom_1f1(2+3j, 3+4j) / acb(3+4j).gamma(), dps=25) @@ -2290,6 +2438,7 @@ cdef class acb(flint_scalar): Bessel function `J_n(z)`, where the argument *z* is given by *self* and the order *n* is passed as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: acb(5).bessel_j(1), dps=25) -0.3275791375914652220377343 >>> showgood(lambda: acb(2+3j).bessel_j(1+2j), dps=25) @@ -2305,6 +2454,7 @@ cdef class acb(flint_scalar): Bessel function `Y_n(z)`, where the argument *z* is given by *self* and the order *n* is passed as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: acb(5).bessel_y(1), dps=25) 0.1478631433912268448010507 """ @@ -2319,6 +2469,7 @@ cdef class acb(flint_scalar): *self* and the order *n* is passed as an extra parameter. Optionally a scaled Bessel function can be computed. + >>> from flint import showgood >>> showgood(lambda: acb(5).bessel_k(1), dps=25) 0.004044613445452164208365022 >>> showgood(lambda: acb(5).bessel_k(1, scaled=True), dps=25) @@ -2340,6 +2491,7 @@ cdef class acb(flint_scalar): *self* and the order *n* is passed as an extra parameter. Optionally a scaled Bessel function can be computed. + >>> from flint import showgood >>> showgood(lambda: acb(5).bessel_i(1), dps=25) 24.33564214245052719914305 >>> showgood(lambda: acb(5).bessel_i(1, scaled=True), dps=25) @@ -2357,6 +2509,7 @@ cdef class acb(flint_scalar): """ Principal *n*-th root of *s*. + >>> from flint import showgood >>> showgood(lambda: acb(-1).root(3), dps=25) 0.5000000000000000000000000 + 0.8660254037844386467637232j >>> showgood(lambda: acb(10,11).root(3), dps=25) @@ -2371,6 +2524,7 @@ cdef class acb(flint_scalar): """ Returns the *n*-th nontrivial zero of the Riemann zeta function. + >>> from flint import showgood >>> showgood(lambda: acb.zeta_zero(1), dps=25) 0.5000000000000000000000000 + 14.13472514173469379045725j >>> showgood(lambda: acb.zeta_zero(2), dps=25) @@ -2432,6 +2586,8 @@ cdef class acb(flint_scalar): Computes the integral `\int_a^b f(x) dx` where the integrand *f* is defined by *func*. + >>> from flint import arb + >>> from flint import showgood >>> showgood(lambda: acb.integral(lambda x, _: x.sin(), 0, arb.pi()), dps=25) 2.000000000000000000000000 >>> showgood(lambda: acb.integral(lambda x, _: (x + x.sin()).gamma(), 1, 1+1j), dps=25) @@ -2454,6 +2610,7 @@ cdef class acb(flint_scalar): Some methods have an *analytic* option built-in, so the user simply has to forward this flag: + >>> from flint import showgood >>> showgood(lambda: acb.integral(lambda x, _: x.sqrt(), 1, 4), dps=25) # WRONG!!! 4.669414894781006338774348 >>> showgood(lambda: acb.integral(lambda x, a: x.sqrt(analytic=a), 1, 4), dps=25) # correct @@ -2462,6 +2619,7 @@ cdef class acb(flint_scalar): The following works without handling the *analytic* flag, because the integrand is meromorphic: + >>> from flint import showgood >>> showgood(lambda: acb.integral(lambda x, _: x.sech(), -1000, 1000), dps=25) 3.141592653589793238462643 @@ -2541,6 +2699,7 @@ cdef class acb(flint_scalar): All function values are computed simultaneously and a tuple is returned. + >>> from flint import showgood >>> showgood(lambda: acb(1).coulomb(0.5, 0.25), dps=10) (0.4283180781, 1.218454487, 1.218454487 + 0.4283180781j, 1.218454487 - 0.4283180781j) """ @@ -2559,6 +2718,7 @@ cdef class acb(flint_scalar): Regular Coulomb wave function `F_{\ell}(\eta,z)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: acb(1+1j).coulomb_f(0.5, 0.25), dps=25) 0.3710338871231483199425544 + 0.7267604204004146050054782j """ @@ -2574,6 +2734,7 @@ cdef class acb(flint_scalar): Irregular Coulomb wave function `G_{\ell}(\eta,z)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: acb(1+1j).coulomb_g(0.5, 0.25), dps=25) 1.293346292234270672155324 - 0.3516893313311703662702556j """ diff --git a/src/flint/types/acb_mat.pxd b/src/flint/types/acb_mat.pxd new file mode 100644 index 00000000..d2401a42 --- /dev/null +++ b/src/flint/types/acb_mat.pxd @@ -0,0 +1,7 @@ +from flint.flint_base.flint_base cimport flint_mat +from flint.flintlib.acb_mat cimport acb_mat_t + +cdef class acb_mat(flint_mat): + cdef acb_mat_t val + cpdef long nrows(self) + cpdef long ncols(self) diff --git a/src/flint/acb_mat.pyx b/src/flint/types/acb_mat.pyx similarity index 96% rename from src/flint/acb_mat.pyx rename to src/flint/types/acb_mat.pyx index 5c9c9b5d..56e9db1d 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -1,6 +1,26 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_context cimport getprec from flint.flint_base.flint_base cimport flint_mat +from flint.types.arb_mat cimport arb_mat +from flint.types.fmpz_mat cimport fmpz_mat +from flint.types.fmpq_mat cimport fmpq_mat +from flint.types.arb cimport arb +from flint.types.acb cimport acb +from flint.types.acb_poly cimport acb_poly +from flint.types.acb cimport any_as_acb +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq + +from flint.flintlib.fmpz_mat cimport fmpz_mat_nrows, fmpz_mat_ncols +from flint.flintlib.fmpq_mat cimport fmpq_mat_nrows, fmpq_mat_ncols +from flint.flintlib.mag cimport * +from flint.flintlib.arb cimport * +from flint.flintlib.arb_mat cimport * +from flint.flintlib.arf cimport * +from flint.flintlib.acb cimport * +from flint.flintlib.acb_mat cimport * + +cimport cython cdef acb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat, arb_mat)): @@ -24,7 +44,7 @@ cdef class acb_mat(flint_mat): [ 3.0000, 4.4000 + 0.60000j] """ - cdef acb_mat_t val + # cdef acb_mat_t val def __cinit__(self): acb_mat_init(self.val, 0, 0) @@ -190,6 +210,7 @@ cdef class acb_mat(flint_mat): """ Returns the determinant of the square matrix *s* as an *acb*. + >>> from flint import showgood >>> A = acb_mat(3, 3, range(9)) >>> showgood(lambda: A.det(), dps=25) # singular 0 @@ -518,6 +539,9 @@ cdef class acb_mat(flint_mat): """ Returns whether *t* is contained in *s* (in the sense of balls). + >>> from flint import fmpz_mat + >>> from flint import fmpq_mat + >>> from flint import arb_mat >>> A = acb_mat([[1,2],[3,4]]) >>> ((A / 3) * 3).contains(A) True @@ -669,6 +693,8 @@ cdef class acb_mat(flint_mat): Ill-conditioned or large matrices may require high precision to isolate the eigenvalues:: + >>> from flint import showgood + >>> from flint import arb_mat >>> sum(acb_mat(arb_mat.hilbert(20,20)).eig()) Traceback (most recent call last): ... diff --git a/src/flint/types/acb_poly.pxd b/src/flint/types/acb_poly.pxd new file mode 100644 index 00000000..eff7b2e3 --- /dev/null +++ b/src/flint/types/acb_poly.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_poly + +from flint.flintlib.acb_poly cimport acb_poly_t + +cdef acb_poly_set_list(acb_poly_t poly, list val, long prec) +cdef class acb_poly(flint_poly): + cdef acb_poly_t val + cpdef long length(self) + cpdef long degree(self) diff --git a/src/flint/acb_poly.pyx b/src/flint/types/acb_poly.pyx similarity index 95% rename from src/flint/acb_poly.pyx rename to src/flint/types/acb_poly.pyx index 64e7d3cc..db9dc77b 100644 --- a/src/flint/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -1,6 +1,23 @@ +from cpython.list cimport PyList_GET_SIZE from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_context cimport getprec from flint.flint_base.flint_base cimport flint_poly +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.arb_poly cimport arb_poly +from flint.types.acb cimport acb_set_python +from flint.types.acb cimport any_as_acb +from flint.types.acb cimport acb +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq +from flint.types.arb cimport arb + +from flint.flintlib.mag cimport * +from flint.flintlib.arf cimport * +from flint.flintlib.arb cimport * +from flint.flintlib.acb cimport * +from flint.flintlib.acb_poly cimport * +cimport libc.stdlib cdef acb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, complex, fmpz, fmpq, arb, acb, fmpz_poly, fmpq_poly, arb_poly)): @@ -10,7 +27,7 @@ cdef acb_poly_coerce_operands(x, y): cdef acb_poly_set_list(acb_poly_t poly, list val, long prec): cdef long i, n cdef acb_t x - n = PyList_GET_SIZE(val) + n = PyList_GET_SIZE(val) acb_poly_fit_length(poly, n) acb_init(x) for i in range(n): @@ -35,7 +52,7 @@ cdef int acb_vec_check_tol(acb_srcptr vec, long n, tol) except -1: cdef class acb_poly(flint_poly): - cdef acb_poly_t val + # cdef acb_poly_t val def __cinit__(self): acb_poly_init(self.val) diff --git a/src/flint/types/acb_series.pxd b/src/flint/types/acb_series.pxd new file mode 100644 index 00000000..66896994 --- /dev/null +++ b/src/flint/types/acb_series.pxd @@ -0,0 +1,10 @@ +from flint.flint_base.flint_base cimport flint_series + +from flint.flintlib.acb_poly cimport acb_poly_t + +cdef class acb_series(flint_series): + cdef acb_poly_t val + cdef long prec + cpdef long length(self) + cpdef valuation(self) + diff --git a/src/flint/acb_series.pyx b/src/flint/types/acb_series.pyx similarity index 96% rename from src/flint/acb_series.pyx rename to src/flint/types/acb_series.pyx index fc399b14..39b399da 100644 --- a/src/flint/acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -1,6 +1,29 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_context cimport getprec, getcap from flint.flint_base.flint_base cimport flint_series +from flint.types.fmpz_series cimport fmpz_series +from flint.types.fmpq_series cimport fmpq_series +from flint.types.arb_series cimport arb_series +from flint.types.acb cimport acb +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.arb_poly cimport arb_poly +from flint.types.arb_poly cimport arb_poly_set_list +from flint.types.acb_poly cimport acb_poly_set_list +from flint.types.arb cimport arb +from flint.types.acb_poly cimport acb_poly +from flint.types.dirichlet cimport dirichlet_char +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq +from flint.types.fmpz cimport any_as_fmpz +from flint.flintlib.acb cimport * +from flint.flintlib.acb_poly cimport * +from flint.flintlib.acb_modular cimport * +from flint.flintlib.acb_hypgeom cimport * +from flint.flintlib.acb_dirichlet cimport * + +cimport cython +cimport libc.stdlib cdef acb_series_coerce_operands(x, y): if isinstance(y, (int, long, float, complex, fmpz, fmpz_poly, fmpz_series, fmpq, fmpq_poly, fmpq_series, arb, arb_poly, arb_series, acb, acb_poly)): @@ -9,8 +32,8 @@ cdef acb_series_coerce_operands(x, y): cdef class acb_series(flint_series): - cdef acb_poly_t val - cdef long prec + # cdef acb_poly_t val + # cdef long prec def __cinit__(self): acb_poly_init(self.val) diff --git a/src/flint/types/arb.pxd b/src/flint/types/arb.pxd new file mode 100644 index 00000000..fbe1447e --- /dev/null +++ b/src/flint/types/arb.pxd @@ -0,0 +1,17 @@ +from flint.flint_base.flint_base cimport flint_scalar + +from flint.flintlib.arb cimport arb_t + +cdef any_as_arb_or_notimplemented(x) +cdef int arb_set_python(arb_t x, obj, bint allow_conversion) except -1 +cdef any_as_arb(x) +cdef arb_set_mpmath_mpf(arb_t x, obj) + +cdef class arb(flint_scalar): + cdef arb_t val + + cpdef bint is_zero(self) + cpdef bint is_finite(self) + cpdef bint is_nan(self) + cpdef bint is_exact(self) + cpdef bint is_integer(self) diff --git a/src/flint/arb.pyx b/src/flint/types/arb.pyx similarity index 92% rename from src/flint/arb.pyx rename to src/flint/types/arb.pyx index fea26eae..129a519a 100644 --- a/src/flint/arb.pyx +++ b/src/flint/types/arb.pyx @@ -1,16 +1,38 @@ +from cpython.float cimport PyFloat_AS_DOUBLE from cpython.version cimport PY_MAJOR_VERSION +from cpython.int cimport PyInt_AS_LONG +from cpython.long cimport PyLong_Check +from cpython.int cimport PyInt_Check from flint.flint_base.flint_context cimport getprec +from flint.flint_base.flint_context cimport thectx from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck -from flint.utils.conversion cimport chars_from_str, str_from_chars - -cdef _str_trunc(s, trunc=0): - if trunc > 0 and len(s) > 3 * trunc: - left = right = trunc - omitted = len(s) - left - right - return s[:left] + ("{...%s digits...}" % omitted) + s[-right:] - return s +from flint.utils.conversion cimport chars_from_str, str_from_chars, _str_trunc +from flint.types.fmpz cimport fmpz_set_pylong +from flint.types.arf cimport arf +from flint.types.fmpq cimport fmpq +from flint.types.fmpz cimport fmpz + +from flint._flint cimport FMPZ_UNKNOWN, FMPZ_TMP, FMPZ_REF +from flint.flintlib.mag cimport * +from flint.flintlib.fmpz cimport fmpz_init, fmpz_clear +from flint.flintlib.arf cimport * +from flint.flintlib.arb cimport * +from flint.flintlib.arb_hypgeom cimport * +from flint.flintlib.acb_dirichlet cimport * + +cimport libc.stdlib +cimport cython + +ctx = thectx + +# cdef _str_trunc(s, trunc=0): +# if trunc > 0 and len(s) > 3 * trunc: +# left = right = trunc +# omitted = len(s) - left - right +# return s[:left] + ("{...%s digits...}" % omitted) + s[-right:] +# return s cdef arb_from_str(str s): s = s.strip() @@ -64,11 +86,11 @@ cdef int arb_set_python(arb_t x, obj, bint allow_conversion) except -1: arb_set_fmpq(x, (obj).val, getprec()) return 1 - if PY_MAJOR_VERSION < 3 and PyInt_Check(obj): - arb_set_si(x, PyInt_AS_LONG(obj)) + if PY_MAJOR_VERSION < 3 and PyInt_Check(obj): + arb_set_si(x, PyInt_AS_LONG(obj)) return 1 - if PyLong_Check(obj): + if PyLong_Check(obj): fmpz_init(t) fmpz_set_pylong(t, obj) arb_set_fmpz(x, t) @@ -76,7 +98,7 @@ cdef int arb_set_python(arb_t x, obj, bint allow_conversion) except -1: return 1 if typecheck(obj, float): - arf_set_d(arb_midref(x), PyFloat_AS_DOUBLE(obj)) + arf_set_d(arb_midref(x), PyFloat_AS_DOUBLE(obj)) mag_zero(arb_radref(x)) return 1 @@ -124,7 +146,7 @@ cdef any_as_arb_or_notimplemented(x): return t cdef class arb(flint_scalar): - ur""" + r""" Represents a real number `x` by a midpoint `m` and a radius `r` such that `x \in [m \pm r] = [m-r, m+r]`. The midpoint and radius are both floating-point numbers. The radius @@ -162,7 +184,7 @@ cdef class arb(flint_scalar): See :meth:`.arb.str` for details. """ - cdef arb_t val + # cdef arb_t val def __cinit__(self): arb_init(self.val) @@ -684,6 +706,7 @@ cdef class arb(flint_scalar): r""" Square root `\sqrt{s}`. + >>> from flint import showgood >>> showgood(lambda: arb(3).sqrt(), dps=25) 1.732050807568877293527446 >>> showgood(lambda: arb(0).sqrt(), dps=25) @@ -704,6 +727,7 @@ cdef class arb(flint_scalar): r""" Reciprocal square root `1/\sqrt{s}`. + >>> from flint import showgood >>> showgood(lambda: arb(3).rsqrt(), dps=25) 0.5773502691896257645091488 >>> showgood(lambda: arb(0).rsqrt(), dps=25) @@ -726,6 +750,7 @@ cdef class arb(flint_scalar): r""" Exponential function `\exp(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).exp(), dps=25) 2.718281828459045235360287 """ @@ -737,6 +762,7 @@ cdef class arb(flint_scalar): r""" Exponential function `\exp(s) - 1`, computed accurately for small *s*. + >>> from flint import showgood >>> showgood(lambda: (arb(10) ** -8).expm1(), dps=25) 1.000000005000000016666667e-8 """ @@ -748,6 +774,7 @@ cdef class arb(flint_scalar): r""" Natural logarithm `\log(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(2).log(), dps=25) 0.6931471805599453094172321 >>> showgood(lambda: arb(100).exp().log(), dps=25) @@ -768,6 +795,8 @@ cdef class arb(flint_scalar): r""" Natural logarithm `\log(1+s)`, computed accurately for small *s*. + >>> from flint import showgood + >>> from flint import acb >>> showgood(lambda: acb(1).log1p(), dps=25) 0.6931471805599453094172321 >>> showgood(lambda: arb("1e-100000000000000000").log1p(), dps=25) @@ -784,6 +813,7 @@ cdef class arb(flint_scalar): r""" Sine function `\sin(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).sin(), dps=25) 0.8414709848078965066525023 """ @@ -795,6 +825,7 @@ cdef class arb(flint_scalar): r""" Cosine function `\cos(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).cos(), dps=25) 0.5403023058681397174009366 """ @@ -806,6 +837,7 @@ cdef class arb(flint_scalar): r""" Computes `\sin(s)` and `\cos(s)` simultaneously. + >>> from flint import showgood >>> showgood(lambda: arb(1).sin_cos(), dps=25) (0.8414709848078965066525023, 0.5403023058681397174009366) """ @@ -818,6 +850,7 @@ cdef class arb(flint_scalar): r""" Sine function `\sin(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: arb(0.75).sin_pi(), dps=25) 0.7071067811865475244008444 >>> showgood(lambda: arb(1).sin_pi(), dps=25) @@ -831,6 +864,7 @@ cdef class arb(flint_scalar): r""" Cosine function `\cos(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: arb(0.75).cos_pi(), dps=25) -0.7071067811865475244008444 >>> showgood(lambda: arb(0.5).cos_pi(), dps=25) @@ -844,6 +878,7 @@ cdef class arb(flint_scalar): r""" Computes `\sin(\pi s)` and `\cos(\pi s)` simultaneously. + >>> from flint import showgood >>> showgood(lambda: arb(0.75).sin_cos_pi(), dps=25) (0.7071067811865475244008444, -0.7071067811865475244008444) """ @@ -856,6 +891,7 @@ cdef class arb(flint_scalar): r""" Tangent function `\tan(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).tan(), dps=25) 1.557407724654902230506975 """ @@ -867,6 +903,7 @@ cdef class arb(flint_scalar): r""" Cotangent function `\cot(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).cot(), dps=25) 0.6420926159343307030064200 """ @@ -878,6 +915,7 @@ cdef class arb(flint_scalar): r""" Tangent function `\tan(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: arb(0.125).tan_pi(), dps=25) 0.4142135623730950488016887 >>> showgood(lambda: arb(1).tan_pi(), dps=25) @@ -891,6 +929,7 @@ cdef class arb(flint_scalar): r""" Cotangent function `\cot(\pi s)`. + >>> from flint import showgood >>> showgood(lambda: arb(0.125).cot_pi(), dps=25) 2.414213562373095048801689 >>> showgood(lambda: arb(0.5).cot_pi(), dps=25) @@ -905,6 +944,8 @@ cdef class arb(flint_scalar): r""" Returns the algebraic sine value `\sin(\pi s)`. + >>> from flint import fmpq + >>> from flint import showgood >>> showgood(lambda: arb.sin_pi_fmpq(fmpq(3,4)), dps=25) 0.7071067811865475244008444 """ @@ -917,6 +958,8 @@ cdef class arb(flint_scalar): r""" Returns the algebraic cosine value `\cos(\pi s)`. + >>> from flint import fmpq + >>> from flint import showgood >>> showgood(lambda: arb.cos_pi_fmpq(fmpq(3,4)), dps=25) -0.7071067811865475244008444 """ @@ -929,6 +972,8 @@ cdef class arb(flint_scalar): r""" Computes `\sin(\pi s)` and `\cos(\pi s)` simultaneously. + >>> from flint import fmpq + >>> from flint import showgood >>> showgood(lambda: arb.sin_cos_pi_fmpq(fmpq(3,4)), dps=25) (0.7071067811865475244008444, -0.7071067811865475244008444) """ @@ -941,6 +986,7 @@ cdef class arb(flint_scalar): """ Secant function `\operatorname{sec}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).sec(), dps=25) 1.850815717680925617911753 """ @@ -952,6 +998,7 @@ cdef class arb(flint_scalar): """ Cosecant function `\operatorname{csc}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).csc(), dps=25) 1.188395105778121216261599 """ @@ -963,6 +1010,7 @@ cdef class arb(flint_scalar): r""" Sinc function, `\operatorname{sinc}(x) = \sin(x)/x`. + >>> from flint import showgood >>> showgood(lambda: arb(3).sinc(), dps=25) 0.04704000268662240736691493 """ @@ -974,6 +1022,7 @@ cdef class arb(flint_scalar): r""" Normalized sinc function, `\operatorname{sinc}(\pi x) = \sin(\pi x)/(\pi x)`. + >>> from flint import showgood >>> showgood(lambda: arb(1.5).sinc_pi(), dps=25) -0.2122065907891937810251784 >>> showgood(lambda: arb(2).sinc_pi(), dps=25) @@ -987,6 +1036,7 @@ cdef class arb(flint_scalar): r""" Inverse tangent `\operatorname{atan}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).atan(), dps=25) 0.7853981633974483096156608 """ @@ -999,6 +1049,7 @@ cdef class arb(flint_scalar): r""" Two-argument inverse tangent `\operatorname{atan2}(s,t)`. + >>> from flint import showgood >>> showgood(lambda: arb.atan2(-10,-5), dps=25) -2.034443935795702735445578 """ @@ -1012,6 +1063,7 @@ cdef class arb(flint_scalar): r""" Inverse cosine `\operatorname{acos}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(0).acos(), dps=25) 1.570796326794896619231322 """ @@ -1023,6 +1075,7 @@ cdef class arb(flint_scalar): r""" Inverse sine `\operatorname{asin}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).asin(), dps=25) 1.570796326794896619231322 """ @@ -1034,6 +1087,7 @@ cdef class arb(flint_scalar): r""" Inverse hyperbolic tangent `\operatorname{atanh}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb("0.99").atanh(), dps=25) 2.646652412362246197705061 """ @@ -1045,6 +1099,7 @@ cdef class arb(flint_scalar): r""" Inverse hyperbolic sine `\operatorname{asinh}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1000).asinh(), dps=25) 7.600902709541988611523290 """ @@ -1056,6 +1111,7 @@ cdef class arb(flint_scalar): r""" Inverse hyperbolic cosine `\operatorname{acosh}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(2).acosh(), dps=25) 1.316957896924816708625046 """ @@ -1067,6 +1123,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic sine `\sinh(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).sinh(), dps=25) 1.175201193643801456882382 """ @@ -1078,6 +1135,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic cosine `\cosh(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).cosh(), dps=25) 1.543080634815243778477906 """ @@ -1089,6 +1147,7 @@ cdef class arb(flint_scalar): r""" Computes `\sinh(s)` and `\cosh(s)` simultaneously. + >>> from flint import showgood >>> showgood(lambda: arb(1).sinh_cosh(), dps=25) (1.175201193643801456882382, 1.543080634815243778477906) """ @@ -1101,6 +1160,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic tangent `\tanh(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).tanh(), dps=25) 0.7615941559557648881194583 """ @@ -1112,6 +1172,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic cotangent `\coth(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).coth(), dps=25) 1.313035285499331303636161 """ @@ -1123,6 +1184,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic secant `\operatorname{sech}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).sech(), dps=25) 0.6480542736638853995749774 """ @@ -1134,6 +1196,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic cosecant `\operatorname{csch}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).csch(), dps=25) 0.8509181282393215451338428 """ @@ -1145,6 +1208,7 @@ cdef class arb(flint_scalar): """ Gamma function `\Gamma(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(10).gamma(), dps=25) 362880.0000000000000000000 >>> showgood(lambda: arb(-2.5).gamma(), dps=25) @@ -1167,6 +1231,8 @@ cdef class arb(flint_scalar): exploiting the fact that *s* is an exact rational number to improve performance. + >>> from flint import fmpq + >>> from flint import showgood >>> showgood(lambda: arb.gamma_fmpq(fmpq(1,4)), dps=25) 3.625609908221908311930685 """ @@ -1179,6 +1245,7 @@ cdef class arb(flint_scalar): Reciprocal gamma function `1/\Gamma(s)`, avoiding division by zero at the poles of the gamma function. + >>> from flint import showgood >>> showgood(lambda: arb(1.5).rgamma(), dps=25) 1.128379167095512573896159 >>> print(arb(0).rgamma()) @@ -1196,6 +1263,7 @@ cdef class arb(flint_scalar): """ Logarithmic gamma function `\log \Gamma(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(100).lgamma(), dps=25) 359.1342053695753987760440 @@ -1210,6 +1278,7 @@ cdef class arb(flint_scalar): """ Digamma function `\psi(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).digamma(), dps=25) -0.5772156649015328606065121 """ @@ -1221,6 +1290,7 @@ cdef class arb(flint_scalar): """ Rising factorial `(s)_n`. + >>> from flint import showgood >>> showgood(lambda: arb.pi().rising(0), dps=25) 1.000000000000000000000000 >>> showgood(lambda: arb.pi().rising(10), dps=25) @@ -1240,6 +1310,8 @@ cdef class arb(flint_scalar): number and *n* is an unsigned integer. The current implementation does not use the gamma function, so *n* should be moderate. + >>> from flint import fmpq + >>> from flint import showgood >>> showgood(lambda: arb.rising_fmpq_ui(fmpq(-1,3), 100), dps=25) -4.960517984074284420131903e+154 """ @@ -1269,6 +1341,7 @@ cdef class arb(flint_scalar): Riemann zeta function `\zeta(s)` or the Hurwitz zeta function `\zeta(s,a)` if a second parameter is passed. + >>> from flint import showgood >>> showgood(lambda: arb(4.25).zeta(), dps=25) 1.066954190711214532450370 >>> showgood(lambda: arb(4.25).zeta(2.75), dps=25) @@ -1290,6 +1363,7 @@ cdef class arb(flint_scalar): The arithmetic-geometric mean `M(s,t)`, or `M(s) = M(s,1)` if no extra parameter is passed. + >>> from flint import showgood >>> showgood(lambda: arb(2).sqrt().agm(), dps=25) 1.198140234735592207439922 >>> showgood(lambda: arb(2).agm(100), dps=25) @@ -1317,6 +1391,7 @@ cdef class arb(flint_scalar): Computes the Bernoulli number `B_n` as an *arb*, where *n* is a given integer. + >>> from flint import showgood >>> showgood(lambda: arb.bernoulli(1), dps=25) -0.5000000000000000000000000 >>> showgood(lambda: arb.bernoulli(2), dps=25) @@ -1336,6 +1411,7 @@ cdef class arb(flint_scalar): r""" Computes the Bell number `B_n` as an *arb*, where *n* is a given integer. + >>> from flint import showgood >>> showgood(lambda: arb.bell_number(1), dps=25) 1.000000000000000000000000 >>> showgood(lambda: arb.bell_number(10), dps=25) @@ -1353,6 +1429,7 @@ cdef class arb(flint_scalar): """ Number of partitions of the integer *n*, evaluated as an *arb*. + >>> from flint import showgood >>> showgood(lambda: arb.partitions_p(10), dps=25) 42.00000000000000000000000 >>> showgood(lambda: arb.partitions_p(100), dps=25) @@ -1369,6 +1446,7 @@ cdef class arb(flint_scalar): """ Returns the value of the Bernoulli polynomial `B_n(s)`. + >>> from flint import showgood >>> showgood(lambda: arb("3.141").bernoulli_poly(5), dps=25) 113.5165117028492010000000 """ @@ -1380,6 +1458,7 @@ cdef class arb(flint_scalar): r""" Factorial, equivalent to `s! = \Gamma(s+1)`. + >>> from flint import showgood >>> showgood(lambda: arb(5).fac(), dps=25) 120.0000000000000000000000 >>> showgood(lambda: arb("0.1").fac(), dps=25) @@ -1397,6 +1476,7 @@ cdef class arb(flint_scalar): >>> print(arb.fac_ui(10)) 3628800.00000000 + >>> from flint import showgood >>> showgood(lambda: arb.fac_ui(10**9).log(), dps=25) 19723265848.22698260792313 """ @@ -1412,6 +1492,7 @@ cdef class arb(flint_scalar): >>> print(arb(10).bin(5)) 252.000000000000 + >>> from flint import showgood >>> showgood(lambda: arb.pi().bin(100), dps=25) 5.478392395095119521549286e-9 """ @@ -1439,6 +1520,7 @@ cdef class arb(flint_scalar): >>> print(arb.fib(10)) 55.0000000000000 + >>> from flint import showgood >>> showgood(lambda: arb.fib(10**100).log(), dps=25) 4.812118250596034474977589e+99 """ @@ -1453,6 +1535,7 @@ cdef class arb(flint_scalar): the argument *z* is given by *self* and the order *s* is given as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: arb(-1).polylog(2), dps=25) -0.8224670334241132182362076 >>> showgood(lambda: arb(-3).polylog(1.75), dps=25) @@ -1473,6 +1556,7 @@ cdef class arb(flint_scalar): Airy function `\operatorname{Ai}(s)`, or `\operatorname{Ai}'(s)` if *derivative* is 1. + >>> from flint import showgood >>> showgood(lambda: arb(-1).airy_ai(), dps=25) 0.5355608832923521187995166 >>> showgood(lambda: arb(-1).airy_ai(derivative=1), dps=25) @@ -1492,6 +1576,7 @@ cdef class arb(flint_scalar): Airy function `\operatorname{Bi}(s)`, or `\operatorname{Bi}'(s)` if *derivative* is 1. + >>> from flint import showgood >>> showgood(lambda: arb(-1).airy_bi(), dps=25) 0.1039973894969446118886900 >>> showgood(lambda: arb(-1).airy_bi(derivative=1), dps=25) @@ -1512,6 +1597,7 @@ cdef class arb(flint_scalar): `\operatorname{Ai}'(s)`, `\operatorname{Bi}(s)`, `\operatorname{Bi}'(s)` simultaneously, returning a tuple. + >>> from flint import showgood >>> showgood(lambda: arb(-1).airy(), dps=10) (0.5355608833, -0.01016056712, 0.1039973895, 0.5923756264) """ @@ -1530,6 +1616,7 @@ cdef class arb(flint_scalar): Airy function `\operatorname{Ai}(s)`, or the corresponding zero `a'_n` of `\operatorname{Ai}'(s)` if *derivative* is 1. + >>> from flint import showgood >>> showgood(lambda: arb.airy_ai_zero(1), dps=25) -2.338107410459767038489197 >>> showgood(lambda: arb.airy_ai_zero(1000), dps=25) @@ -1556,6 +1643,7 @@ cdef class arb(flint_scalar): Airy function `\operatorname{Bi}(s)`, or the corresponding zero `b'_n` of `\operatorname{Bi}'(s)` if *derivative* is 1. + >>> from flint import showgood >>> showgood(lambda: arb.airy_bi_zero(1), dps=25) -1.173713222709127924919980 >>> showgood(lambda: arb.airy_bi_zero(1000), dps=25) @@ -1579,6 +1667,7 @@ cdef class arb(flint_scalar): r""" Chebyshev function of the first kind `T_n(s)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).chebyshev_t(3), dps=25) -0.8518518518518518518518519 """ @@ -1591,6 +1680,7 @@ cdef class arb(flint_scalar): r""" Chebyshev function of the second kind `U_n(s)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).chebyshev_u(3), dps=25) -1.037037037037037037037037 """ @@ -1603,6 +1693,7 @@ cdef class arb(flint_scalar): r""" Jacobi polynomial (or Jacobi function) `P_n^{a,b}(s)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).jacobi_p(5, 0.25, 0.5), dps=25) 0.4131944444444444444444444 """ @@ -1617,6 +1708,7 @@ cdef class arb(flint_scalar): r""" Gegenbauer function `C_n^{m}(s)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).gegenbauer_c(5, 0.25), dps=25) 0.1321855709876543209876543 """ @@ -1630,6 +1722,7 @@ cdef class arb(flint_scalar): r""" Laguerre function `L_n^{m}(s)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).laguerre_l(5, 0.25), dps=25) 0.03871323490012002743484225 """ @@ -1643,6 +1736,7 @@ cdef class arb(flint_scalar): r""" Hermite function `H_n(s)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).hermite_h(5), dps=25) 34.20576131687242798353909 """ @@ -1655,6 +1749,7 @@ cdef class arb(flint_scalar): r""" Legendre function of the first kind `P_n^m(z)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).legendre_p(5), dps=25) 0.3333333333333333333333333 >>> showgood(lambda: (arb(1)/3).legendre_p(5, 1.5), dps=25) @@ -1678,6 +1773,7 @@ cdef class arb(flint_scalar): r""" Legendre function of the second kind `Q_n^m(z)`. + >>> from flint import showgood >>> showgood(lambda: (arb(1)/3).legendre_q(5), dps=25) 0.1655245300933242182362054 >>> showgood(lambda: (arb(1)/3).legendre_q(5, 1.5), dps=25) @@ -1705,6 +1801,7 @@ cdef class arb(flint_scalar): the zero and *w* is the corresponding weight for Gauss-Legendre quadrature on `(-1,1)`. + >>> from flint import showgood >>> for k in range(5): ... showgood(lambda: arb.legendre_p_root(5,k), dps=25) ... @@ -1739,6 +1836,7 @@ cdef class arb(flint_scalar): r""" Error function `\operatorname{erf}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).erf(), dps=25) 0.9999779095030014145586272 """ @@ -1750,6 +1848,7 @@ cdef class arb(flint_scalar): r""" Complementary error function `\operatorname{erfc}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).erfc(), dps=25) 2.209049699858544137277613e-5 """ @@ -1761,6 +1860,7 @@ cdef class arb(flint_scalar): r""" Imaginary error function `\operatorname{erfi}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).erfi(), dps=25) 1629.994622601565651061648 """ @@ -1772,6 +1872,7 @@ cdef class arb(flint_scalar): r""" Fresnel sine integral `S(s)`, optionally not normalized. + >>> from flint import showgood >>> showgood(lambda: arb(3).fresnel_s(), dps=25) 0.4963129989673750360976123 >>> showgood(lambda: arb(3).fresnel_s(normalized=False), dps=25) @@ -1785,6 +1886,7 @@ cdef class arb(flint_scalar): r""" Fresnel cosine integral `C(s)`, optionally not normalized. + >>> from flint import showgood >>> showgood(lambda: arb(3).fresnel_c(), dps=25) 0.6057207892976856295561611 >>> showgood(lambda: arb(3).fresnel_c(normalized=False), dps=25) @@ -1798,6 +1900,7 @@ cdef class arb(flint_scalar): r""" Exponential integral `\operatorname{Ei}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).ei(), dps=25) 9.933832570625416558008336 """ @@ -1809,6 +1912,7 @@ cdef class arb(flint_scalar): r""" Sine integral `\operatorname{Si}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).si(), dps=25) 1.848652527999468256397730 """ @@ -1820,6 +1924,7 @@ cdef class arb(flint_scalar): r""" Cosine integral `\operatorname{Ci}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).ci(), dps=25) 0.1196297860080003276264723 """ @@ -1831,6 +1936,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic sine integral `\operatorname{Shi}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).shi(), dps=25) 4.973440475859806797710418 """ @@ -1842,6 +1948,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic cosine integral `\operatorname{Chi}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(3).chi(), dps=25) 4.960392094765609760297918 """ @@ -1855,6 +1962,7 @@ cdef class arb(flint_scalar): the offset logarithmic integral `\operatorname{Li}(s) = \operatorname{li}(s) - \operatorname{li}(2)`. + >>> from flint import showgood >>> showgood(lambda: arb(10).li(), dps=25) 6.165599504787297937522982 >>> showgood(lambda: arb(10).li(offset=True), dps=25) @@ -1869,6 +1977,7 @@ cdef class arb(flint_scalar): Bessel function `J_n(z)`, where the argument *z* is given by *self* and the order *n* is passed as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: arb(5).bessel_j(1), dps=25) -0.3275791375914652220377343 """ @@ -1882,6 +1991,7 @@ cdef class arb(flint_scalar): Bessel function `Y_n(z)`, where the argument *z* is given by *self* and the order *n* is passed as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: arb(5).bessel_y(1), dps=25) 0.1478631433912268448010507 """ @@ -1896,6 +2006,7 @@ cdef class arb(flint_scalar): *self* and the order *n* is passed as an extra parameter. Optionally a scaled Bessel function can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(5).bessel_k(1), dps=25) 0.004044613445452164208365022 >>> showgood(lambda: arb(5).bessel_k(1, scaled=True), dps=25) @@ -1915,6 +2026,7 @@ cdef class arb(flint_scalar): *self* and the order *n* is passed as an extra parameter. Optionally a scaled Bessel function can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(5).bessel_i(1), dps=25) 24.33564214245052719914305 >>> showgood(lambda: arb(5).bessel_i(1, scaled=True), dps=25) @@ -1934,6 +2046,7 @@ cdef class arb(flint_scalar): is given by *self* and the order *s* is passed as an extra parameter. Optionally the regularized version `Q(s,z)` can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(5).gamma_upper(2.5), dps=25) 0.1000132513171574223384170 >>> showgood(lambda: arb(5).gamma_upper(2.5, regularized=1), dps=25) @@ -1951,6 +2064,7 @@ cdef class arb(flint_scalar): Optionally the regularized versions `P(s,z)` and `\gamma^{*}(s,z) = z^{-s} P(s,z)` can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(5).gamma_lower(2.5), dps=25) 1.229327136861979598135209 >>> showgood(lambda: arb(5).gamma_lower(2.5, regularized=1), dps=25) @@ -1970,6 +2084,7 @@ cdef class arb(flint_scalar): as extra function arguments. Optionally the regularized version of this function can be computed. + >>> from flint import showgood >>> showgood(lambda: arb("0.9").beta_lower(1, 2.5), dps=25) 0.3987350889359326482672004 >>> showgood(lambda: arb("0.9").beta_lower(1, 2.5, regularized=True), dps=25) @@ -1986,6 +2101,7 @@ cdef class arb(flint_scalar): Generalized exponential integral `E_s(z)`. The argument *z* is given by *self* and the order *s* is passed as an extra parameter. + >>> from flint import showgood >>> showgood(lambda: arb(5).expint(2), dps=25) 0.0009964690427088381099832386 """ @@ -2002,6 +2118,7 @@ cdef class arb(flint_scalar): Optionally the regularized hypergeometric function can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(5).hypgeom([1,2,3],[5,4.5,6]), dps=25) 1.301849229178968153998454 >>> showgood(lambda: arb(5).hypgeom([1,2,3],[5,4.5,6],regularized=True), dps=25) @@ -2030,6 +2147,7 @@ cdef class arb(flint_scalar): The hypergeometric function `U(a,b,z)` where the argument *z* is given by *self* + >>> from flint import showgood >>> showgood(lambda: arb(5).hypgeom_u(1, 2.5), dps=25) 0.2184157028890778783289036 """ @@ -2045,6 +2163,7 @@ cdef class arb(flint_scalar): is given by *self* Optionally the regularized version of this function can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(-5).hypgeom_1f1(1, 2.5), dps=25) 0.2652884733179767675077230 >>> showgood(lambda: arb(-5).hypgeom_1f1(1, 2.5, regularized=True), dps=25) @@ -2062,6 +2181,7 @@ cdef class arb(flint_scalar): is given by *self* Optionally the regularized version of this function can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(-5).hypgeom_0f1(2.5), dps=25) 0.003114611044402738470826907 >>> showgood(lambda: arb(-5).hypgeom_0f1(2.5, regularized=True), dps=25) @@ -2078,6 +2198,7 @@ cdef class arb(flint_scalar): is given by *self* Optionally the regularized version of this function can be computed. + >>> from flint import showgood >>> showgood(lambda: arb(-5).hypgeom_2f1(1,2,3), dps=25) 0.2566592424617555999350018 >>> showgood(lambda: arb(-5).hypgeom_2f1(1,2,3,regularized=True), dps=25) @@ -2088,6 +2209,7 @@ cdef class arb(flint_scalar): exact integers, even if the input intervals are inexact. If the parameters are exact, these flags are not needed. + >>> from flint import showgood >>> showgood(lambda: arb("9/10").hypgeom_2f1(arb(2).sqrt(), 0.5, arb(2).sqrt()+1.5, abc=True), dps=25) 1.447530478120770807945697 >>> showgood(lambda: arb("9/10").hypgeom_2f1(arb(2).sqrt(), 0.5, arb(2).sqrt()+1.5), dps=25) @@ -2115,6 +2237,7 @@ cdef class arb(flint_scalar): """ Returns the constant `\pi` as an *arb*. + >>> from flint import showgood >>> showgood(arb.pi, dps=25) 3.141592653589793238462643 """ @@ -2127,6 +2250,7 @@ cdef class arb(flint_scalar): """ The constant `\sqrt{\pi}`. + >>> from flint import showgood >>> showgood(arb.const_sqrt_pi, dps=25) 1.772453850905516027298167 """ @@ -2139,6 +2263,7 @@ cdef class arb(flint_scalar): """ The constant `\log(2)`. + >>> from flint import showgood >>> showgood(arb.const_log2, dps=25) 0.6931471805599453094172321 """ @@ -2151,6 +2276,7 @@ cdef class arb(flint_scalar): """ The constant `\log(10)`. + >>> from flint import showgood >>> showgood(arb.const_log10, dps=25) 2.302585092994045684017991 """ @@ -2163,6 +2289,7 @@ cdef class arb(flint_scalar): """ Euler's constant `\gamma`. + >>> from flint import showgood >>> showgood(arb.const_euler, dps=25) 0.5772156649015328606065121 """ @@ -2175,6 +2302,7 @@ cdef class arb(flint_scalar): """ Catalan's constant. + >>> from flint import showgood >>> showgood(arb.const_catalan, dps=25) 0.9159655941772190150546035 """ @@ -2187,6 +2315,7 @@ cdef class arb(flint_scalar): """ The constant `e`. + >>> from flint import showgood >>> showgood(arb.const_e, dps=25) 2.718281828459045235360287 """ @@ -2199,6 +2328,7 @@ cdef class arb(flint_scalar): """ Khinchin's constant `K`. + >>> from flint import showgood >>> showgood(arb.const_khinchin, dps=25) 2.685452001065306445309715 """ @@ -2211,6 +2341,7 @@ cdef class arb(flint_scalar): """ Glaisher's constant. + >>> from flint import showgood >>> showgood(arb.const_glaisher, dps=25) 1.282427129100622636875343 """ @@ -2264,6 +2395,7 @@ cdef class arb(flint_scalar): branch (`k = 0`) or the `k = -1` branch can be computed by specifying *branch*. + >>> from flint import showgood >>> showgood(lambda: arb(10).lambertw(), dps=25) 1.745528002740699383074301 >>> showgood(lambda: arb("-0.1").lambertw(-1), dps=25) @@ -2349,6 +2481,7 @@ cdef class arb(flint_scalar): """ Principal *n*-th root of *s*. + >>> from flint import showgood >>> showgood(lambda: arb(10).root(3), dps=25) 2.154434690031883721759294 """ @@ -2361,6 +2494,7 @@ cdef class arb(flint_scalar): """ Returns the *n*-th Gram point. + >>> from flint import showgood >>> showgood(lambda: arb.gram_point(-1), dps=25) 9.666908056130192141261536 >>> showgood(lambda: arb.gram_point(0), dps=25) @@ -2400,6 +2534,7 @@ cdef class arb(flint_scalar): """ Backlund *S* function related to the Riemann zeta function. + >>> from flint import showgood >>> showgood(lambda: arb(123).backlund_s(), dps=25) 0.4757920863536796196115749 """ @@ -2414,6 +2549,7 @@ cdef class arb(flint_scalar): Both function values are computed simultaneously and a tuple is returned. + >>> from flint import showgood >>> showgood(lambda: arb(1).coulomb(0.5, 0.25), dps=10) (0.4283180781, 1.218454487) """ @@ -2430,6 +2566,7 @@ cdef class arb(flint_scalar): Regular Coulomb wave function `F_{\ell}(\eta,z)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: arb(1).coulomb_f(0.5, 0.25), dps=25) 0.4283180781043541845555944 """ @@ -2445,6 +2582,7 @@ cdef class arb(flint_scalar): Irregular Coulomb wave function `G_{\ell}(\eta,z)` where *z* is given by *self*. + >>> from flint import showgood >>> showgood(lambda: arb(1).coulomb_g(0.5, 0.25), dps=25) 1.218454487206367973745641 """ @@ -2454,3 +2592,4 @@ cdef class arb(flint_scalar): arb_hypgeom_coulomb(NULL, (G).val, (l).val, (eta).val, (self).val, getprec()) return G + diff --git a/src/flint/types/arb_mat.pxd b/src/flint/types/arb_mat.pxd new file mode 100644 index 00000000..b7c578c7 --- /dev/null +++ b/src/flint/types/arb_mat.pxd @@ -0,0 +1,7 @@ +from flint.flint_base.flint_base cimport flint_mat +from flint.flintlib.arb_mat cimport arb_mat_t + +cdef class arb_mat(flint_mat): + cdef arb_mat_t val + cpdef long nrows(self) + cpdef long ncols(self) diff --git a/src/flint/arb_mat.pyx b/src/flint/types/arb_mat.pyx similarity index 96% rename from src/flint/arb_mat.pyx rename to src/flint/types/arb_mat.pyx index a7e778dc..c85b6eef 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/types/arb_mat.pyx @@ -1,6 +1,23 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_context cimport getprec from flint.flint_base.flint_base cimport flint_mat +from flint.types.fmpq_mat cimport fmpq_mat +from flint.types.fmpz_mat cimport fmpz_mat +from flint.types.arb cimport arb +from flint.types.arb_poly cimport arb_poly +from flint.types.arb cimport any_as_arb +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq +from flint.types.acb cimport acb +from flint.types.acb_mat cimport acb_mat +from flint.types.acb cimport any_as_acb + +from flint.flintlib.fmpz_mat cimport fmpz_mat_nrows, fmpz_mat_ncols +from flint.flintlib.fmpq_mat cimport fmpq_mat_nrows, fmpq_mat_ncols +from flint.flintlib.arf cimport * +from flint.flintlib.arb cimport * +from flint.flintlib.arb_mat cimport * +cimport cython cdef arb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat)): @@ -32,7 +49,7 @@ cdef class arb_mat(flint_mat): """ - cdef arb_mat_t val + # cdef arb_mat_t val def __cinit__(self): arb_mat_init(self.val, 0, 0) @@ -178,6 +195,7 @@ cdef class arb_mat(flint_mat): """ Returns the determinant of the square matrix *s* as an *arb*. + >>> from flint import showgood >>> A = arb_mat(3, 3, range(9)) >>> showgood(lambda: A.det(), dps=25) # exact singular 0 @@ -595,6 +613,8 @@ cdef class arb_mat(flint_mat): """ Returns whether *t* is contained in *s* (in the sense of balls). + >>> from flint import fmpz_mat + >>> from flint import fmpq_mat >>> A = arb_mat([[1,2],[3,4]]) >>> ((A / 3) * 3).contains(A) True diff --git a/src/flint/types/arb_poly.pxd b/src/flint/types/arb_poly.pxd new file mode 100644 index 00000000..536e39dc --- /dev/null +++ b/src/flint/types/arb_poly.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_poly +from flint.flintlib.arb_poly cimport arb_poly_t + +cdef arb_poly_set_list(arb_poly_t poly, list val, long prec) + +cdef class arb_poly(flint_poly): + cdef arb_poly_t val + cpdef long length(self) + cpdef long degree(self) diff --git a/src/flint/arb_poly.pyx b/src/flint/types/arb_poly.pyx similarity index 95% rename from src/flint/arb_poly.pyx rename to src/flint/types/arb_poly.pyx index bca26fd3..85ad978d 100644 --- a/src/flint/arb_poly.pyx +++ b/src/flint/types/arb_poly.pyx @@ -1,6 +1,21 @@ +from cpython.list cimport PyList_GET_SIZE from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_context cimport getprec from flint.flint_base.flint_base cimport flint_poly +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.arb cimport arb_set_python +from flint.types.arb cimport any_as_arb +from flint.types.arb cimport arb +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq +from flint.types.acb cimport acb +from flint.types.acb_poly cimport acb_poly + +from flint.flintlib.arb cimport * +from flint.flintlib.arb_poly cimport * +cimport cython +cimport libc.stdlib cdef arb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, fmpz, fmpq, arb, fmpz_poly, fmpq_poly)): @@ -12,7 +27,7 @@ cdef arb_poly_coerce_operands(x, y): cdef arb_poly_set_list(arb_poly_t poly, list val, long prec): cdef long i, n cdef arb_t x - n = PyList_GET_SIZE(val) + n = PyList_GET_SIZE(val) arb_poly_fit_length(poly, n) arb_init(x) for i in range(n): @@ -27,7 +42,7 @@ cdef arb_poly_set_list(arb_poly_t poly, list val, long prec): cdef class arb_poly(flint_poly): - cdef arb_poly_t val + # cdef arb_poly_t val def __cinit__(self): arb_poly_init(self.val) diff --git a/src/flint/types/arb_series.pxd b/src/flint/types/arb_series.pxd new file mode 100644 index 00000000..efbd35ad --- /dev/null +++ b/src/flint/types/arb_series.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_series + +from flint.flintlib.arb_poly cimport arb_poly_t + +cdef class arb_series(flint_series): + cdef arb_poly_t val + cdef long prec + cpdef long length(self) + cpdef valuation(self) diff --git a/src/flint/arb_series.pyx b/src/flint/types/arb_series.pyx similarity index 97% rename from src/flint/arb_series.pyx rename to src/flint/types/arb_series.pyx index 30c018b9..46b1151c 100644 --- a/src/flint/arb_series.pyx +++ b/src/flint/types/arb_series.pyx @@ -1,6 +1,25 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_context cimport getprec, getcap +from flint.flint_base.flint_context cimport thectx from flint.flint_base.flint_base cimport flint_series +from flint.types.fmpz_series cimport fmpz_series +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq_series cimport fmpq_series +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.arb_poly cimport arb_poly_set_list +from flint.types.arb cimport arb +from flint.types.arb_poly cimport arb_poly +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq +from flint.types.acb cimport acb +from flint.types.acb_poly cimport acb_poly +from flint.types.acb_series cimport acb_series + +from flint.flintlib.arb cimport * +from flint.flintlib.arb_poly cimport * +from flint.flintlib.arb_hypgeom cimport * + +ctx = thectx cdef arb_series_coerce_operands(x, y): if isinstance(y, (int, long, float, fmpz, fmpz_poly, fmpz_series, fmpq, fmpq_poly, fmpq_series, arb, arb_poly)): @@ -11,8 +30,8 @@ cdef arb_series_coerce_operands(x, y): cdef class arb_series(flint_series): - cdef arb_poly_t val - cdef long prec + # cdef arb_poly_t val + # cdef long prec def __cinit__(self): arb_poly_init(self.val) diff --git a/src/flint/types/arf.pxd b/src/flint/types/arf.pxd new file mode 100644 index 00000000..1784585b --- /dev/null +++ b/src/flint/types/arf.pxd @@ -0,0 +1,9 @@ +from flint.flintlib.arf cimport arf_t + +cdef class arf: + cdef arf_t val + cpdef bint is_finite(self) + cpdef bint is_pos_inf(self) + cpdef bint is_neg_inf(self) + cpdef bint is_nan(self) + cpdef bint is_zero(self) diff --git a/src/flint/arf.pyx b/src/flint/types/arf.pyx similarity index 94% rename from src/flint/arf.pyx rename to src/flint/types/arf.pyx index b13b5539..53d1ef30 100644 --- a/src/flint/arf.pyx +++ b/src/flint/types/arf.pyx @@ -1,10 +1,19 @@ +from cpython.float cimport PyFloat_AS_DOUBLE from flint.flint_base.flint_context cimport getprec +from flint.flint_base.flint_context cimport thectx from flint.utils.typecheck cimport typecheck from flint.utils.conversion cimport prec_to_dps +from flint.types.fmpz cimport fmpz +from flint.types.fmpz cimport any_as_fmpz +from flint.types.arb cimport arb + +from flint.flintlib.arf cimport * + +ctx = thectx cdef class arf: - cdef arf_t val + # cdef arf_t val def __cinit__(self): arf_init(self.val) @@ -33,7 +42,7 @@ cdef class arf: elif typecheck(val, arf): arf_set(self.val, (val).val) elif typecheck(val, float): - arf_set_d(self.val, PyFloat_AS_DOUBLE(val)) + arf_set_d(self.val, PyFloat_AS_DOUBLE(val)) elif typecheck(val, tuple): man = any_as_fmpz(val[0]) exp = any_as_fmpz(val[1]) diff --git a/src/flint/types/dirichlet.pxd b/src/flint/types/dirichlet.pxd new file mode 100644 index 00000000..18988a7a --- /dev/null +++ b/src/flint/types/dirichlet.pxd @@ -0,0 +1,13 @@ +from flint.flintlib.dirichlet cimport dirichlet_group_t +from flint.flintlib.dirichlet cimport dirichlet_char_t + +cdef class dirichlet_group(object): + cdef dirichlet_group_t val + cdef int _init + + cpdef long size(self) + +cdef class dirichlet_char(object): + + cdef dirichlet_char_t val + cdef dirichlet_group G diff --git a/src/flint/dirichlet.pyx b/src/flint/types/dirichlet.pyx similarity index 91% rename from src/flint/dirichlet.pyx rename to src/flint/types/dirichlet.pyx index 8ec160ec..613ca704 100644 --- a/src/flint/dirichlet.pyx +++ b/src/flint/types/dirichlet.pyx @@ -1,4 +1,12 @@ from flint.flint_base.flint_context cimport getprec +from flint.types.acb cimport any_as_acb +from flint.types.acb cimport acb +from flint.types.fmpz cimport fmpz + +from flint.flintlib.ulong_extras cimport n_gcd +from flint.flintlib.fmpz cimport fmpz_get_ui +from flint.flintlib.dirichlet cimport * +from flint.flintlib.acb_dirichlet cimport * cdef dict _dirichlet_group_cache = {} @@ -11,8 +19,8 @@ cdef class dirichlet_group(object): Dirichlet group mod q = 5 """ - cdef dirichlet_group_t val - cdef int _init + # cdef dirichlet_group_t val + # cdef int _init def __cinit__(self): self._init = 0 @@ -74,8 +82,8 @@ cdef class dirichlet_char(object): -1.00000000000000 """ - cdef dirichlet_char_t val - cdef dirichlet_group G + # cdef dirichlet_char_t val + # cdef dirichlet_group G def __cinit__(self): pass @@ -167,6 +175,7 @@ cdef class dirichlet_char(object): Evaluates the Dirichlet L-function of this character at the given complex number s. + >>> from flint import showgood >>> chi = dirichlet_char(1, 1) >>> showgood(lambda: chi.l(2), dps=25) 1.644934066848226436472415 @@ -187,6 +196,7 @@ cdef class dirichlet_char(object): complex number s. >>> chi = dirichlet_char(1, 1) + >>> from flint import showgood >>> showgood(lambda: chi.hardy_z(1), dps=25) -0.7363054628673177346778998 diff --git a/src/flint/types/fmpq.pxd b/src/flint/types/fmpq.pxd new file mode 100644 index 00000000..3ef00f3c --- /dev/null +++ b/src/flint/types/fmpq.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_scalar + +from flint.flintlib.fmpq cimport fmpq_t + +cdef any_as_fmpq(obj) +cdef class fmpq(flint_scalar): + cdef fmpq_t val + + diff --git a/src/flint/fmpq.pyx b/src/flint/types/fmpq.pyx similarity index 95% rename from src/flint/fmpq.pyx rename to src/flint/types/fmpq.pyx index 10fb162d..35f81a3d 100644 --- a/src/flint/fmpq.pyx +++ b/src/flint/types/fmpq.pyx @@ -1,12 +1,25 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck +from flint.types.fmpz cimport fmpz_set_any_ref +from flint.types.fmpz cimport fmpz +from flint.types.fmpz cimport any_as_fmpz + +from flint._flint cimport FMPZ_UNKNOWN, FMPZ_TMP +from flint.flintlib.fmpz cimport fmpz_set, fmpz_one +from flint.flintlib.fmpz cimport fmpz_is_zero, fmpz_sgn +from flint.flintlib.fmpz cimport fmpz_fdiv_q, fmpz_bits +from flint.flintlib.fmpz cimport fmpz_cdiv_q +from flint.flintlib.fmpz cimport fmpz_tdiv_q +from flint.flintlib.fmpz cimport fmpz_clear +from flint.flintlib.fmpq cimport * +from flint.flintlib.bernoulli cimport * cdef any_as_fmpq(obj): if typecheck(obj, fmpq): return obj z = any_as_fmpz(obj) if z is NotImplemented: - return z + return z q = fmpq.__new__(fmpq) fmpz_set(fmpq_numref((q).val), (z).val) fmpz_one(fmpq_denref((q).val)) @@ -21,7 +34,7 @@ cdef class fmpq(flint_scalar): """ - cdef fmpq_t val +# cdef fmpq_t val def __cinit__(self): fmpq_init(self.val) diff --git a/src/flint/types/fmpq_mat.pxd b/src/flint/types/fmpq_mat.pxd new file mode 100644 index 00000000..702002f8 --- /dev/null +++ b/src/flint/types/fmpq_mat.pxd @@ -0,0 +1,17 @@ +from flint.flint_base.flint_base cimport flint_mat + +from flint.flintlib.fmpq_mat cimport fmpq_mat_t +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq +from flint.types.fmpz_mat cimport fmpz_mat + +cdef class fmpq_mat(flint_mat): + cdef fmpq_mat_t val + + cpdef long nrows(self) + cpdef long ncols(self) + cdef __mul_fmpz(self, fmpz c) + cdef __mul_fmpq(self, fmpq c) + cdef __mul_fmpq_mat(self, fmpq_mat other) + cdef __mul_fmpz_mat(self, fmpz_mat other) + cdef __mul_r_fmpz_mat(self, fmpz_mat other) diff --git a/src/flint/fmpq_mat.pyx b/src/flint/types/fmpq_mat.pyx similarity index 96% rename from src/flint/fmpq_mat.pyx rename to src/flint/types/fmpq_mat.pyx index a8442e5a..bb322729 100644 --- a/src/flint/fmpq_mat.pyx +++ b/src/flint/types/fmpq_mat.pyx @@ -1,5 +1,17 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.fmpq cimport any_as_fmpq +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq_poly cimport fmpq_poly_set_list +from flint.types.fmpz cimport any_as_fmpz + +from flint.flintlib.fmpz_mat cimport fmpz_mat_nrows, fmpz_mat_ncols +from flint.flintlib.fmpq cimport fmpq_set,fmpq_numref, fmpq_denref +from flint.flintlib.fmpq_poly cimport fmpq_poly_init, fmpq_poly_clear +from flint.flintlib.fmpq_mat cimport * + +cimport cython cdef any_as_fmpq_mat(obj): if typecheck(obj, fmpq_mat): @@ -11,7 +23,7 @@ cdef any_as_fmpq_mat(obj): cdef class fmpq_mat(flint_mat): """ Represents a dense matrix over the rational numbers. - + >>> from flint import fmpq >>> A = fmpq_mat(3,3,[1,3,5,2,4,6,fmpq(2,3),2,4]) >>> A.inv() [-3, 3/2, 3/2] @@ -24,7 +36,7 @@ cdef class fmpq_mat(flint_mat): """ - cdef fmpq_mat_t val + # cdef fmpq_mat_t val def __cinit__(self): fmpq_mat_init(self.val, 0, 0) diff --git a/src/flint/types/fmpq_poly.pxd b/src/flint/types/fmpq_poly.pxd new file mode 100644 index 00000000..2353cded --- /dev/null +++ b/src/flint/types/fmpq_poly.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_poly +from flint.flintlib.fmpq_poly cimport fmpq_poly_t + +cdef fmpq_poly_set_list(fmpq_poly_t poly, list val) +cdef any_as_fmpq_poly(obj) +cdef class fmpq_poly(flint_poly): + cdef fmpq_poly_t val + cpdef long length(self) + cpdef long degree(self) diff --git a/src/flint/fmpq_poly.pyx b/src/flint/types/fmpq_poly.pyx similarity index 94% rename from src/flint/fmpq_poly.pyx rename to src/flint/types/fmpq_poly.pyx index 7e3d957d..b485bd0a 100644 --- a/src/flint/fmpq_poly.pyx +++ b/src/flint/types/fmpq_poly.pyx @@ -1,5 +1,20 @@ +from cpython.list cimport PyList_GET_SIZE from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_poly +from flint.types.fmpz_poly cimport any_as_fmpz_poly +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq cimport fmpq +from flint.types.fmpq cimport any_as_fmpq +from flint.types.fmpz cimport fmpz +from flint.types.fmpz cimport any_as_fmpz + +from flint.flintlib.fmpz cimport fmpz_is_zero +from flint.flintlib.fmpz cimport fmpz_set +from flint.flintlib.fmpq cimport fmpq_is_zero +from flint.flintlib.fmpq_poly cimport * +from flint.flintlib.arith cimport arith_bernoulli_polynomial +from flint.flintlib.arith cimport arith_euler_polynomial +from flint.flintlib.arith cimport arith_legendre_polynomial cdef any_as_fmpq_poly(obj): if typecheck(obj, fmpq_poly): @@ -23,7 +38,7 @@ cdef any_as_fmpq_poly(obj): cdef fmpq_poly_set_list(fmpq_poly_t poly, list val): cdef long i, n - n = PyList_GET_SIZE(val) + n = PyList_GET_SIZE(val) fmpq_poly_fit_length(poly, n) for i from 0 <= i < n: c = val[i] @@ -43,6 +58,7 @@ cdef class fmpq_poly(flint_poly): over the rational numbers. For efficiency reasons, an *fmpq_poly* is structurally an integer polynomial with a single common denominator. + >>> from flint import ctx >>> fmpq_poly([1,2,3],5) ** 3 27/125*x^6 + 54/125*x^5 + 63/125*x^4 + 44/125*x^3 + 21/125*x^2 + 6/125*x + 1/125 >>> ctx.pretty = False @@ -54,7 +70,7 @@ cdef class fmpq_poly(flint_poly): """ - cdef fmpq_poly_t val + # cdef fmpq_poly_t val def __cinit__(self): fmpq_poly_init(self.val) @@ -373,6 +389,7 @@ cdef class fmpq_poly(flint_poly): Computes the complex roots of this polynomial. See :meth:`.fmpz_poly.roots`. + >>> from flint import fmpq >>> fmpq_poly([fmpq(2,3),1]).roots() [([-0.666666666666667 +/- 3.34e-16], 1)] """ diff --git a/src/flint/types/fmpq_series.pxd b/src/flint/types/fmpq_series.pxd new file mode 100644 index 00000000..968791b8 --- /dev/null +++ b/src/flint/types/fmpq_series.pxd @@ -0,0 +1,10 @@ +from flint.flint_base.flint_base cimport flint_series +from flint.flintlib.fmpq_poly cimport fmpq_poly_t + +cdef class fmpq_series(flint_series): + cdef fmpq_poly_t val + cdef long prec + cpdef long length(self) + cpdef valuation(self) + cdef bint zero_constant_term(s) + cdef bint one_constant_term(s) diff --git a/src/flint/fmpq_series.pyx b/src/flint/types/fmpq_series.pyx similarity index 95% rename from src/flint/fmpq_series.pyx rename to src/flint/types/fmpq_series.pyx index 5dc26225..644fab5a 100644 --- a/src/flint/fmpq_series.pyx +++ b/src/flint/types/fmpq_series.pyx @@ -1,5 +1,22 @@ from flint.flint_base.flint_base cimport flint_series from flint.utils.typecheck cimport typecheck +from flint.flint_base.flint_context cimport getcap +from flint.types.fmpz_series cimport fmpz_series +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.fmpq_poly cimport fmpq_poly_set_list +from flint.types.fmpz cimport fmpz +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq cimport fmpq +from flint.types.arb cimport arb +from flint.types.arb_poly cimport arb_poly +from flint.types.arb_series cimport arb_series +from flint.types.acb cimport acb +from flint.types.acb_poly cimport acb_poly +from flint.types.acb_series cimport acb_series +from flint.types.fmpz cimport any_as_fmpz + +from flint.flintlib.fmpz cimport fmpz_is_zero,fmpz_set,fmpz_equal +from flint.flintlib.fmpq_poly cimport * cdef fmpq_series_coerce_operands(x, y): if isinstance(y, (int, long, fmpz, fmpz_poly, fmpz_series, fmpq, fmpq_poly)): @@ -14,8 +31,8 @@ cdef fmpq_series_coerce_operands(x, y): cdef class fmpq_series(flint_series): - cdef fmpq_poly_t val - cdef long prec + # cdef fmpq_poly_t val + # cdef long prec def __cinit__(self): fmpq_poly_init(self.val) diff --git a/src/flint/types/fmpz.pxd b/src/flint/types/fmpz.pxd new file mode 100644 index 00000000..d23f5f71 --- /dev/null +++ b/src/flint/types/fmpz.pxd @@ -0,0 +1,43 @@ +from cpython.int cimport PyInt_Check, PyInt_AS_LONG +from cpython.long cimport PyLong_Check +from flint.flint_base.flint_base cimport flint_scalar +from flint.utils.conversion cimport chars_from_str + +from flint._flint cimport slong, pylong_as_slong +from flint._flint cimport PyObject +from flint.flintlib.fmpz cimport fmpz_t, fmpz_set_str, fmpz_set_si + +from cpython.version cimport PY_MAJOR_VERSION + +cdef int fmpz_set_any_ref(fmpz_t x, obj) + +cdef inline int fmpz_set_pylong(fmpz_t x, obj): + cdef int overflow + cdef slong longval + longval = pylong_as_slong(obj, &overflow) + if overflow: + s = "%x" % obj + fmpz_set_str(x, chars_from_str(s), 16) + else: + fmpz_set_si(x, longval) + +cdef inline int fmpz_set_python(fmpz_t x, obj): + if PY_MAJOR_VERSION < 3 and PyInt_Check(obj): + fmpz_set_si(x, PyInt_AS_LONG(obj)) + return 1 + if PyLong_Check(obj): + fmpz_set_pylong(x, obj) + return 1 + return 0 +cdef any_as_fmpz(obj) + +cdef class fmpz(flint_scalar): + """ + The *fmpz* type represents an arbitrary-size integer. + + >>> fmpz(3) ** 25 + 847288609443 + + """ + + cdef fmpz_t val diff --git a/src/flint/fmpz.pyx b/src/flint/types/fmpz.pyx similarity index 96% rename from src/flint/fmpz.pyx rename to src/flint/types/fmpz.pyx index b898cfd2..45f7b6f9 100644 --- a/src/flint/fmpz.pyx +++ b/src/flint/types/fmpz.pyx @@ -3,25 +3,14 @@ from cpython.version cimport PY_MAJOR_VERSION from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck from flint.utils.conversion cimport chars_from_str +from flint.utils.conversion cimport str_from_chars, _str_trunc +cimport libc.stdlib -cdef inline int fmpz_set_pylong(fmpz_t x, obj): - cdef int overflow - cdef slong longval - longval = pylong_as_slong(obj, &overflow) - if overflow: - s = "%x" % obj - fmpz_set_str(x, chars_from_str(s), 16) - else: - fmpz_set_si(x, longval) - -cdef inline int fmpz_set_python(fmpz_t x, obj): - if PY_MAJOR_VERSION < 3 and PyInt_Check(obj): - fmpz_set_si(x, PyInt_AS_LONG(obj)) - return 1 - if PyLong_Check(obj): - fmpz_set_pylong(x, obj) - return 1 - return 0 +from flint._flint cimport FMPZ_REF, FMPZ_TMP, FMPZ_UNKNOWN +from flint.flintlib.fmpz cimport * +from flint.flintlib.fmpz_factor cimport * +from flint.flintlib.arith cimport * +from flint.flintlib.partitions cimport * cdef fmpz_get_intlong(fmpz_t x): """ @@ -40,11 +29,11 @@ cdef int fmpz_set_any_ref(fmpz_t x, obj): if typecheck(obj, fmpz): x[0] = (obj).val[0] return FMPZ_REF - if PY_MAJOR_VERSION < 3 and PyInt_Check(obj): + if PY_MAJOR_VERSION < 3 and PyInt_Check(obj): fmpz_init(x) - fmpz_set_si(x, PyInt_AS_LONG(obj)) + fmpz_set_si(x, PyInt_AS_LONG(obj)) return FMPZ_TMP - if PyLong_Check(obj): + if PyLong_Check(obj): fmpz_init(x) fmpz_set_pylong(x, obj) return FMPZ_TMP @@ -76,8 +65,6 @@ cdef class fmpz(flint_scalar): """ - cdef fmpz_t val - def __cinit__(self): fmpz_init(self.val) @@ -143,8 +130,8 @@ cdef class fmpz(flint_scalar): cdef fmpz_struct * sval cdef int ttype sval = &((s).val[0]) - if PY_MAJOR_VERSION < 3 and PyInt_Check(t): - tl = PyInt_AS_LONG(t) + if PY_MAJOR_VERSION < 3 and PyInt_Check(t): + tl = PyInt_AS_LONG(t) if op == 2: res = fmpz_cmp_si(sval, tl) == 0 elif op == 3: res = fmpz_cmp_si(sval, tl) != 0 elif op == 0: res = fmpz_cmp_si(sval, tl) < 0 diff --git a/src/flint/types/fmpz_mat.pxd b/src/flint/types/fmpz_mat.pxd new file mode 100644 index 00000000..ae482653 --- /dev/null +++ b/src/flint/types/fmpz_mat.pxd @@ -0,0 +1,11 @@ +from flint.flint_base.flint_base cimport flint_mat +from flint.flintlib.fmpz_mat cimport fmpz_mat_t +from flint.types.fmpz cimport fmpz +cdef any_as_fmpz_mat(obj) + +cdef class fmpz_mat(flint_mat): + + cdef fmpz_mat_t val + cpdef long nrows(self) + cpdef long ncols(self) + cdef __mul_fmpz(self, fmpz c) diff --git a/src/flint/fmpz_mat.pyx b/src/flint/types/fmpz_mat.pyx similarity index 96% rename from src/flint/fmpz_mat.pyx rename to src/flint/types/fmpz_mat.pyx index d7a4857c..121f2ce8 100644 --- a/src/flint/fmpz_mat.pyx +++ b/src/flint/types/fmpz_mat.pyx @@ -1,5 +1,22 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck +from flint.types.fmpz cimport fmpz +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq_mat cimport fmpq_mat +from flint.types.fmpz cimport any_as_fmpz +from flint.types.fmpq cimport fmpq +from flint.pyflint cimport global_random_state +from flint.types.fmpq cimport any_as_fmpq +cimport cython + +from flint.flintlib.fmpz cimport fmpz_set, fmpz_init, fmpz_clear +from flint.flintlib.fmpz cimport fmpz_is_zero, fmpz_is_pm1 +from flint.flintlib.fmpz_poly cimport fmpz_poly_init +from flint.flintlib.fmpz_mat cimport * +from flint.flintlib.fmpz_lll cimport * +from flint.flintlib.fmpq_mat cimport fmpq_mat_init +from flint.flintlib.fmpq_mat cimport fmpq_mat_set_fmpz_mat_div_fmpz +from flint.flintlib.fmpq_mat cimport fmpq_mat_solve_fmpz_mat cdef any_as_fmpz_mat(obj): if typecheck(obj, fmpz_mat): @@ -53,6 +70,7 @@ cdef class fmpz_mat(flint_mat): Disabling pretty-printing:: + >>> from flint import ctx >>> ctx.pretty = False >>> fmpz_mat([[1,2,3],[4,5,6]]) fmpz_mat(2, 3, [1, 2, 3, 4, 5, 6]) @@ -60,7 +78,7 @@ cdef class fmpz_mat(flint_mat): """ - cdef fmpz_mat_t val + # cdef fmpz_mat_t val def __cinit__(self): fmpz_mat_init(self.val, 0, 0) @@ -541,6 +559,7 @@ cdef class fmpz_mat(flint_mat): either returning a new copy or modifying self in-place. Returns (*rref*, *denominator*, *rank*). + >>> from flint import ctx >>> ctx.pretty = False >>> A = fmpz_mat(3,3,range(9)) >>> A.rref() diff --git a/src/flint/types/fmpz_mpoly.pxd b/src/flint/types/fmpz_mpoly.pxd new file mode 100644 index 00000000..8cf863c3 --- /dev/null +++ b/src/flint/types/fmpz_mpoly.pxd @@ -0,0 +1,16 @@ +from flint.flint_base.flint_base cimport flint_mpoly + +from flint.flintlib.fmpz_mpoly cimport fmpz_mpoly_ctx_t +from flint.flintlib.fmpz_mpoly cimport fmpz_mpoly_t +from flint._flint cimport slong + +cdef class fmpz_mpoly_ctx: + cdef fmpz_mpoly_ctx_t val + cpdef slong nvars(self) + + cpdef ordering(self) + +cdef class fmpz_mpoly(flint_mpoly): + cdef fmpz_mpoly_t val + cdef fmpz_mpoly_ctx ctx + cdef bint _init diff --git a/src/flint/fmpz_mpoly.pyx b/src/flint/types/fmpz_mpoly.pyx similarity index 98% rename from src/flint/fmpz_mpoly.pyx rename to src/flint/types/fmpz_mpoly.pyx index f94c085d..1e179c9b 100644 --- a/src/flint/fmpz_mpoly.pyx +++ b/src/flint/types/fmpz_mpoly.pyx @@ -3,6 +3,12 @@ from cpython.version cimport PY_MAJOR_VERSION from flint.utils.conversion cimport str_from_chars from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_mpoly +from flint.types.fmpz cimport any_as_fmpz +from flint.types.fmpz cimport fmpz + +cimport cython +cimport libc.stdlib +from flint.flintlib.fmpz_mpoly cimport * cdef any_as_fmpz_mpoly(x): cdef fmpz_mpoly res @@ -47,7 +53,7 @@ cdef dict _fmpz_mpoly_ctx_cache = {} @cython.auto_pickle(False) cdef class fmpz_mpoly_ctx: - cdef fmpz_mpoly_ctx_t val +# cdef fmpz_mpoly_ctx_t val def __init__(self, slong nvars, ordering="lex"): assert nvars >= 1 @@ -117,9 +123,9 @@ cdef class fmpz_mpoly(flint_mpoly): the integers. """ - cdef fmpz_mpoly_t val - cdef fmpz_mpoly_ctx ctx - cdef bint _init + # cdef fmpz_mpoly_t val + # cdef fmpz_mpoly_ctx ctx + # cdef bint _init def __cinit__(self): self._init = False diff --git a/src/flint/types/fmpz_poly.pxd b/src/flint/types/fmpz_poly.pxd new file mode 100644 index 00000000..61bc109d --- /dev/null +++ b/src/flint/types/fmpz_poly.pxd @@ -0,0 +1,13 @@ + +from flint.flint_base.flint_base cimport flint_poly + +from flint.flintlib.fmpz_poly cimport fmpz_poly_t + +cdef fmpz_poly_set_list(fmpz_poly_t poly, list val) + +cdef any_as_fmpz_poly(x) + +cdef class fmpz_poly(flint_poly): + cdef fmpz_poly_t val + cpdef long length(self) + cpdef long degree(self) diff --git a/src/flint/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx similarity index 93% rename from src/flint/fmpz_poly.pyx rename to src/flint/types/fmpz_poly.pyx index a61a7d99..ba532a62 100644 --- a/src/flint/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -1,8 +1,34 @@ from cpython.version cimport PY_MAJOR_VERSION +from cpython.int cimport PyInt_AS_LONG +from cpython.list cimport PyList_GET_SIZE +from cpython.long cimport PyLong_Check +from cpython.int cimport PyInt_Check from flint.flint_base.flint_context cimport getprec from flint.flint_base.flint_base cimport flint_poly from flint.utils.typecheck cimport typecheck +from flint.types.fmpz cimport fmpz_set_python +from flint.types.fmpz cimport any_as_fmpz +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport any_as_fmpq +from flint.types.fmpq cimport fmpq +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.fmpq_poly cimport any_as_fmpq_poly +from flint.types.acb cimport acb +from flint.types.arb cimport any_as_arb_or_notimplemented +from flint.types.arb cimport arb +from flint.types.acb cimport any_as_acb_or_notimplemented +cimport libc.stdlib +from flint.flintlib.fmpz cimport fmpz_init, fmpz_clear, fmpz_set +from flint.flintlib.fmpz cimport fmpz_is_one, fmpz_equal_si, fmpz_equal +from flint.flintlib.acb_modular cimport * +from flint.flintlib.ulong_extras cimport n_is_prime +from flint.flintlib.fmpz_poly cimport * +from flint.flintlib.fmpz_poly_factor cimport * +from flint.flintlib.arith cimport * +from flint.flintlib.acb cimport * +from flint.flintlib.arb_poly cimport * +from flint.flintlib.arb_fmpz_poly cimport * cdef any_as_fmpz_poly(x): cdef fmpz_poly res @@ -12,11 +38,11 @@ cdef any_as_fmpz_poly(x): res = fmpz_poly.__new__(fmpz_poly) fmpz_poly_set_fmpz(res.val, (x).val) return res - elif PY_MAJOR_VERSION < 3 and PyInt_Check(x): + elif PY_MAJOR_VERSION < 3 and PyInt_Check(x): res = fmpz_poly.__new__(fmpz_poly) - fmpz_poly_set_si(res.val, PyInt_AS_LONG(x)) + fmpz_poly_set_si(res.val, PyInt_AS_LONG(x)) return res - elif PyLong_Check(x): + elif PyLong_Check(x): res = fmpz_poly.__new__(fmpz_poly) t = fmpz(x) fmpz_poly_set_fmpz(res.val, (t).val) @@ -26,7 +52,7 @@ cdef any_as_fmpz_poly(x): cdef fmpz_poly_set_list(fmpz_poly_t poly, list val): cdef long i, n cdef fmpz_t x - n = PyList_GET_SIZE(val) + n = PyList_GET_SIZE(val) fmpz_poly_fit_length(poly, n) fmpz_init(x) for i from 0 <= i < n: @@ -50,8 +76,6 @@ cdef class fmpz_poly(flint_poly): (0, 6*x^4 + x^3 + x^2 + 2) """ - cdef fmpz_poly_t val - def __cinit__(self): fmpz_poly_init(self.val) diff --git a/src/flint/types/fmpz_series.pxd b/src/flint/types/fmpz_series.pxd new file mode 100644 index 00000000..3c476a28 --- /dev/null +++ b/src/flint/types/fmpz_series.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_series + +from flint.flintlib.fmpz_poly cimport fmpz_poly_t + +cdef class fmpz_series(flint_series): + cdef fmpz_poly_t val + cdef long prec + cpdef long length(self) + cpdef valuation(self) diff --git a/src/flint/fmpz_series.pyx b/src/flint/types/fmpz_series.pyx similarity index 94% rename from src/flint/fmpz_series.pyx rename to src/flint/types/fmpz_series.pyx index bfcbc6a9..21549e54 100644 --- a/src/flint/fmpz_series.pyx +++ b/src/flint/types/fmpz_series.pyx @@ -1,5 +1,21 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_series +from flint.flint_base.flint_context cimport getcap +from flint.types.fmpz_poly cimport fmpz_poly_set_list +from flint.types.fmpz cimport fmpz +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.fmpq cimport fmpq +from flint.types.fmpq_poly cimport fmpq_poly +from flint.types.fmpq_series cimport fmpq_series +from flint.types.arb cimport arb +from flint.types.arb_poly cimport arb_poly +from flint.types.arb_series cimport arb_series +from flint.types.acb cimport acb +from flint.types.acb_poly cimport acb_poly +from flint.types.acb_series cimport acb_series + +from flint.flintlib.fmpz cimport fmpz_is_zero, fmpz_is_pm1 +from flint.flintlib.fmpz_poly cimport * cdef fmpz_series_coerce_operands(x, y): if isinstance(y, (int, long, fmpz, fmpz_poly)): @@ -30,8 +46,8 @@ cdef class fmpz_series(flint_series): """ - cdef fmpz_poly_t val - cdef long prec + # cdef fmpz_poly_t val + # cdef long prec def __cinit__(self): fmpz_poly_init(self.val) diff --git a/src/flint/types/nmod.pxd b/src/flint/types/nmod.pxd new file mode 100644 index 00000000..0a441fec --- /dev/null +++ b/src/flint/types/nmod.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_scalar +from flint._flint cimport mp_limb_t +from flint.flintlib.nmod_vec cimport nmod_t + +cdef int any_as_nmod(mp_limb_t * val, obj, nmod_t mod) except -1 + +cdef class nmod(flint_scalar): + cdef mp_limb_t val + cdef nmod_t mod diff --git a/src/flint/nmod.pyx b/src/flint/types/nmod.pyx similarity index 91% rename from src/flint/nmod.pyx rename to src/flint/types/nmod.pyx index 0ffaadaf..bf83f4da 100644 --- a/src/flint/nmod.pyx +++ b/src/flint/types/nmod.pyx @@ -1,5 +1,15 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck +from flint.types.fmpq cimport any_as_fmpq +from flint.types.fmpz cimport any_as_fmpz +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq + +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.nmod_vec cimport * +from flint.flintlib.fmpz cimport fmpz_fdiv_ui, fmpz_init, fmpz_clear +from flint.flintlib.fmpz cimport fmpz_set_ui, fmpz_get_ui +from flint.flintlib.fmpq cimport fmpq_mod_fmpz cdef int any_as_nmod(mp_limb_t * val, obj, nmod_t mod) except -1: cdef int success @@ -34,8 +44,8 @@ cdef class nmod(flint_scalar): """ - cdef mp_limb_t val - cdef nmod_t mod + # cdef mp_limb_t val + # cdef nmod_t mod def __init__(self, val, mod): cdef mp_limb_t m diff --git a/src/flint/types/nmod_mat.pxd b/src/flint/types/nmod_mat.pxd new file mode 100644 index 00000000..7a31e15b --- /dev/null +++ b/src/flint/types/nmod_mat.pxd @@ -0,0 +1,11 @@ +from flint.flint_base.flint_base cimport flint_mat + +from flint.flintlib.nmod_mat cimport nmod_mat_t +from flint._flint cimport mp_limb_t + +cdef class nmod_mat: + cdef nmod_mat_t val + cpdef long nrows(self) + cpdef long ncols(self) + cpdef mp_limb_t modulus(self) + cdef __mul_nmod(self, mp_limb_t c) diff --git a/src/flint/nmod_mat.pyx b/src/flint/types/nmod_mat.pyx similarity index 96% rename from src/flint/nmod_mat.pyx rename to src/flint/types/nmod_mat.pyx index a6d50a7e..6a813433 100644 --- a/src/flint/nmod_mat.pyx +++ b/src/flint/types/nmod_mat.pyx @@ -1,5 +1,19 @@ from flint.utils.conversion cimport matrix_to_str from flint.utils.typecheck cimport typecheck +from flint.types.fmpz_mat cimport any_as_fmpz_mat +from flint.types.fmpz_mat cimport fmpz_mat +from flint.types.nmod cimport nmod +from flint.types.nmod cimport any_as_nmod +from flint.pyflint cimport global_random_state +from flint.flint_base.flint_context cimport thectx + +cimport cython + +from flint._flint cimport ulong +from flint.flintlib.nmod_mat cimport * +from flint.flintlib.fmpz_mat cimport fmpz_mat_nrows, fmpz_mat_ncols +from flint.flintlib.fmpz_mat cimport fmpz_mat_get_nmod_mat +ctx = thectx cdef any_as_nmod_mat(obj, nmod_t mod): cdef nmod_mat r @@ -21,7 +35,7 @@ cdef class nmod_mat: word-size n. Some operations may assume that n is a prime. """ - cdef nmod_mat_t val +# cdef nmod_mat_t val def __dealloc__(self): nmod_mat_clear(self.val) diff --git a/src/flint/types/nmod_poly.pxd b/src/flint/types/nmod_poly.pxd new file mode 100644 index 00000000..ab33f64c --- /dev/null +++ b/src/flint/types/nmod_poly.pxd @@ -0,0 +1,10 @@ +from flint.flint_base.flint_base cimport flint_poly + +from flint.flintlib.nmod_poly cimport nmod_poly_t +from flint._flint cimport mp_limb_t + +cdef class nmod_poly(flint_poly): + cdef nmod_poly_t val + cpdef long length(self) + cpdef long degree(self) + cpdef mp_limb_t modulus(self) diff --git a/src/flint/nmod_poly.pyx b/src/flint/types/nmod_poly.pyx similarity index 96% rename from src/flint/nmod_poly.pyx rename to src/flint/types/nmod_poly.pyx index 3f69f6c7..6128eca9 100644 --- a/src/flint/nmod_poly.pyx +++ b/src/flint/types/nmod_poly.pyx @@ -1,5 +1,14 @@ +from cpython.list cimport PyList_GET_SIZE from flint.flint_base.flint_base cimport flint_poly from flint.utils.typecheck cimport typecheck +from flint.types.fmpz_poly cimport any_as_fmpz_poly +from flint.types.fmpz_poly cimport fmpz_poly +from flint.types.nmod cimport any_as_nmod +from flint.types.nmod cimport nmod + +from flint.flintlib.nmod_vec cimport * +from flint.flintlib.nmod_poly cimport * +from flint.flintlib.fmpz_poly cimport fmpz_poly_get_nmod_poly cdef any_as_nmod_poly(obj, nmod_t mod): cdef nmod_poly r @@ -25,7 +34,7 @@ cdef nmod_poly_set_list(nmod_poly_t poly, list val): cdef nmod_t mod cdef mp_limb_t v nmod_init(&mod, nmod_poly_modulus(poly)) # XXX - n = PyList_GET_SIZE(val) + n = PyList_GET_SIZE(val) nmod_poly_fit_length(poly, n) for i from 0 <= i < n: c = val[i] @@ -39,6 +48,7 @@ cdef class nmod_poly(flint_poly): The nmod_poly type represents dense univariate polynomials over Z/nZ for word-size n. + >>> from flint import ctx >>> a = nmod_poly([5,1,10,14,8], 7) >>> a x^4 + 3*x^2 + x + 5 @@ -55,7 +65,7 @@ cdef class nmod_poly(flint_poly): """ - cdef nmod_poly_t val + # cdef nmod_poly_t val #def __cinit__(self): diff --git a/src/flint/types/nmod_series.pxd b/src/flint/types/nmod_series.pxd new file mode 100644 index 00000000..613a97c9 --- /dev/null +++ b/src/flint/types/nmod_series.pxd @@ -0,0 +1,4 @@ +from flint.flint_base.flint_base cimport flint_series + +cdef class nmod_series(flint_series): + pass diff --git a/src/flint/nmod_series.pyx b/src/flint/types/nmod_series.pyx similarity index 100% rename from src/flint/nmod_series.pyx rename to src/flint/types/nmod_series.pyx diff --git a/src/flint/utils/conversion.pxd b/src/flint/utils/conversion.pxd index 98df1a81..9641969b 100644 --- a/src/flint/utils/conversion.pxd +++ b/src/flint/utils/conversion.pxd @@ -30,3 +30,11 @@ cdef inline matrix_to_str(tab): tab[i] = [s.rjust(widths[j]) for j, s in enumerate(tab[i])] tab[i] = "[" + (", ".join(tab[i])) + "]" return "\n".join(tab) + +cdef inline _str_trunc(s, trunc=0): + if trunc > 0 and len(s) > 3 * trunc: + left = right = trunc + omitted = len(s) - left - right + return s[:left] + ("{...%s digits...}" % omitted) + s[-right:] + return s + diff --git a/src/flint/utils/typecheck.pxd b/src/flint/utils/typecheck.pxd index b8394837..6e48be96 100644 --- a/src/flint/utils/typecheck.pxd +++ b/src/flint/utils/typecheck.pxd @@ -1,4 +1,4 @@ -from flint._flint cimport PyTypeObject, PyObject_TypeCheck +from cpython.object cimport PyTypeObject, PyObject_TypeCheck cdef inline bint typecheck(object ob, object tp): return PyObject_TypeCheck(ob, tp)