From 575f906e1e587d30825ad8b4aefe0bdb1566634d Mon Sep 17 00:00:00 2001 From: David Einstein Date: Fri, 1 Sep 2023 00:03:19 -0400 Subject: [PATCH 01/39] fmpz modularized Made fmpz into its own module (which depends on the other code which depends on it). Hopefully this tedious approach works. --- setup.py | 1 + src/flint/__init__.py | 2 +- src/flint/arb.pyx | 17 +++++------ src/flint/fmpq.pyx | 10 ++++++- src/flint/fmpz.pxd | 41 +++++++++++++++++++++++++++ src/flint/fmpz.pyx | 52 ++++++++++++++++++++-------------- src/flint/fmpz_mat.pyx | 1 + src/flint/fmpz_poly.pyx | 2 ++ src/flint/pyflint.pxd | 4 +++ src/flint/pyflint.pyx | 8 +++--- src/flint/utils/conversion.pxd | 8 ++++++ 11 files changed, 111 insertions(+), 35 deletions(-) create mode 100644 src/flint/fmpz.pxd diff --git a/setup.py b/setup.py index 060a324c..590d39d3 100644 --- a/setup.py +++ b/setup.py @@ -66,6 +66,7 @@ ext_files = [ ("flint._flint", ["src/flint/pyflint.pyx"]), # Main Module # Submodules + ("flint.fmpz", ["src/flint/fmpz.pyx"]), # Main Module ("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..933c24a9 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -1,3 +1,3 @@ from ._flint import * - +from .fmpz import * __version__ = '0.4.2' diff --git a/src/flint/arb.pyx b/src/flint/arb.pyx index fea26eae..4fbedceb 100644 --- a/src/flint/arb.pyx +++ b/src/flint/arb.pyx @@ -3,14 +3,15 @@ from cpython.version cimport PY_MAJOR_VERSION from flint.flint_base.flint_context cimport getprec 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.fmpz cimport fmpz_set_pylong + +# 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() diff --git a/src/flint/fmpq.pyx b/src/flint/fmpq.pyx index 10fb162d..8cca24db 100644 --- a/src/flint/fmpq.pyx +++ b/src/flint/fmpq.pyx @@ -1,12 +1,20 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck +from flint.fmpz cimport fmpz_set_any_ref + + +cdef FMPZ_UNKNOWN = 0 +cdef FMPZ_REF = 1 +cdef FMPZ_TMP = 2 + + 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)) diff --git a/src/flint/fmpz.pxd b/src/flint/fmpz.pxd new file mode 100644 index 00000000..14300bb7 --- /dev/null +++ b/src/flint/fmpz.pxd @@ -0,0 +1,41 @@ +from flint.flint_base.flint_base cimport flint_scalar + +from flint._flint cimport fmpz_t, slong, pylong_as_slong +from flint._flint cimport PyObject, fmpz_set_str, fmpz_set_si +from flint._flint cimport PyInt_Check, PyInt_AS_LONG, PyLong_Check +from flint.utils.conversion cimport chars_from_str + +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/fmpz.pyx index b898cfd2..c92cd303 100644 --- a/src/flint/fmpz.pyx +++ b/src/flint/fmpz.pyx @@ -3,25 +3,37 @@ 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 - -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.utils.conversion cimport str_from_chars, _str_trunc +cimport libc.stdlib + +from flint.fmpz cimport fmpz +from flint._flint cimport * + +cdef FMPZ_UNKNOWN = 0 +cdef FMPZ_REF = 1 +cdef FMPZ_TMP = 2 + +from flint._flint cimport * + + +# 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 fmpz_get_intlong(fmpz_t x): """ @@ -76,8 +88,6 @@ cdef class fmpz(flint_scalar): """ - cdef fmpz_t val - def __cinit__(self): fmpz_init(self.val) diff --git a/src/flint/fmpz_mat.pyx b/src/flint/fmpz_mat.pyx index d7a4857c..cbd72e2e 100644 --- a/src/flint/fmpz_mat.pyx +++ b/src/flint/fmpz_mat.pyx @@ -1,5 +1,6 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck +from flint.fmpz cimport fmpz cdef any_as_fmpz_mat(obj): if typecheck(obj, fmpz_mat): diff --git a/src/flint/fmpz_poly.pyx b/src/flint/fmpz_poly.pyx index a61a7d99..d2f1cbf2 100644 --- a/src/flint/fmpz_poly.pyx +++ b/src/flint/fmpz_poly.pyx @@ -3,6 +3,8 @@ from cpython.version cimport PY_MAJOR_VERSION 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.fmpz cimport fmpz_set_python +from flint.fmpz cimport any_as_fmpz cdef any_as_fmpz_poly(x): cdef fmpz_poly res diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index abfe739f..228ff4fc 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -1,5 +1,9 @@ from flint._flint cimport * +cdef FMPZ_UNKNOWN = 0 +cdef FMPZ_REF = 1 +cdef FMPZ_TMP = 2 + cdef class Context: cpdef public bint pretty cpdef public long prec diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index a9c14ccb..5279444a 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -24,13 +24,13 @@ cdef extern from "Python.h": double PyComplex_RealAsDouble(PyObject *op) double PyComplex_ImagAsDouble(PyObject *op) -DEF FMPZ_UNKNOWN = 0 -DEF FMPZ_REF = 1 -DEF FMPZ_TMP = 2 +#DEF FMPZ_UNKNOWN = 0 +#DEF FMPZ_REF = 1 +#DEF FMPZ_TMP = 2 ctx = thectx -include "fmpz.pyx" +#include "fmpz.pyx" include "fmpz_poly.pyx" include "fmpz_mpoly.pyx" include "fmpz_mat.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 + From cfe0e5504a54e075b2ef3183d59aa313775102b1 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Fri, 1 Sep 2023 15:22:50 -0400 Subject: [PATCH 02/39] Separated fmpz_mpoly Also got rid of the pyflint/_flint twist. I'm not sure how it worked, but Things should be straightforward from now on. --- setup.py | 6 +- src/flint/__init__.py | 3 +- src/flint/acb.pyx | 2 +- src/flint/acb_mat.pyx | 2 +- src/flint/acb_poly.pyx | 2 +- src/flint/acb_series.pyx | 4 +- src/flint/arb.pyx | 2 +- src/flint/arb_mat.pyx | 2 +- src/flint/arb_poly.pyx | 2 +- src/flint/arb_series.pyx | 4 +- src/flint/arf.pyx | 2 +- src/flint/fmpq.pyx | 2 +- src/flint/fmpq_mat.pyx | 2 +- src/flint/fmpq_poly.pyx | 3 +- src/flint/fmpq_series.pyx | 4 +- src/flint/fmpz_mat.pyx | 3 +- src/flint/fmpz_mpoly.pyx | 9 +-- src/flint/fmpz_poly.pxd | 13 ++++ src/flint/fmpz_poly.pyx | 14 +++- src/flint/fmpz_series.pyx | 5 +- src/flint/nmod.pyx | 4 +- src/flint/nmod_mat.pyx | 2 +- src/flint/nmod_poly.pyx | 2 +- src/flint/pyflint.pxd | 132 ++++++++++++++++++++++++++++--------- src/flint/pyflint.pyx | 2 +- src/flint/test/__main__.py | 2 +- 26 files changed, 166 insertions(+), 64 deletions(-) create mode 100644 src/flint/fmpz_poly.pxd diff --git a/setup.py b/setup.py index 590d39d3..bf86d799 100644 --- a/setup.py +++ b/setup.py @@ -64,9 +64,11 @@ 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.fmpz", ["src/flint/fmpz.pyx"]), # Main Module + ("flint.fmpz", ["src/flint/fmpz.pyx"]), + ("flint.fmpz_poly", ["src/flint/fmpz_poly.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 933c24a9..4916cc10 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -1,3 +1,4 @@ -from ._flint import * +from .pyflint import * from .fmpz import * +from .fmpz_poly import * __version__ = '0.4.2' diff --git a/src/flint/acb.pyx b/src/flint/acb.pyx index 7a123bc5..e077669e 100644 --- a/src/flint/acb.pyx +++ b/src/flint/acb.pyx @@ -116,7 +116,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) diff --git a/src/flint/acb_mat.pyx b/src/flint/acb_mat.pyx index 5c9c9b5d..1cb895f4 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/acb_mat.pyx @@ -24,7 +24,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) diff --git a/src/flint/acb_poly.pyx b/src/flint/acb_poly.pyx index 64e7d3cc..5b8908fb 100644 --- a/src/flint/acb_poly.pyx +++ b/src/flint/acb_poly.pyx @@ -35,7 +35,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/acb_series.pyx b/src/flint/acb_series.pyx index fc399b14..82705a1b 100644 --- a/src/flint/acb_series.pyx +++ b/src/flint/acb_series.pyx @@ -9,8 +9,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/arb.pyx b/src/flint/arb.pyx index 4fbedceb..c486042e 100644 --- a/src/flint/arb.pyx +++ b/src/flint/arb.pyx @@ -163,7 +163,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) diff --git a/src/flint/arb_mat.pyx b/src/flint/arb_mat.pyx index a7e778dc..b0d0f15c 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -32,7 +32,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) diff --git a/src/flint/arb_poly.pyx b/src/flint/arb_poly.pyx index bca26fd3..66622fb3 100644 --- a/src/flint/arb_poly.pyx +++ b/src/flint/arb_poly.pyx @@ -27,7 +27,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/arb_series.pyx b/src/flint/arb_series.pyx index 30c018b9..1a836fb5 100644 --- a/src/flint/arb_series.pyx +++ b/src/flint/arb_series.pyx @@ -11,8 +11,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/arf.pyx b/src/flint/arf.pyx index b13b5539..342e655b 100644 --- a/src/flint/arf.pyx +++ b/src/flint/arf.pyx @@ -4,7 +4,7 @@ from flint.utils.conversion cimport prec_to_dps cdef class arf: - cdef arf_t val + # cdef arf_t val def __cinit__(self): arf_init(self.val) diff --git a/src/flint/fmpq.pyx b/src/flint/fmpq.pyx index 8cca24db..a576ee1c 100644 --- a/src/flint/fmpq.pyx +++ b/src/flint/fmpq.pyx @@ -29,7 +29,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/fmpq_mat.pyx b/src/flint/fmpq_mat.pyx index a8442e5a..892abbd4 100644 --- a/src/flint/fmpq_mat.pyx +++ b/src/flint/fmpq_mat.pyx @@ -24,7 +24,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/fmpq_poly.pyx b/src/flint/fmpq_poly.pyx index 7e3d957d..c86dd296 100644 --- a/src/flint/fmpq_poly.pyx +++ b/src/flint/fmpq_poly.pyx @@ -1,5 +1,6 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_poly +from flint.fmpz_poly cimport any_as_fmpz_poly cdef any_as_fmpq_poly(obj): if typecheck(obj, fmpq_poly): @@ -54,7 +55,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) diff --git a/src/flint/fmpq_series.pyx b/src/flint/fmpq_series.pyx index 5dc26225..aa6095ac 100644 --- a/src/flint/fmpq_series.pyx +++ b/src/flint/fmpq_series.pyx @@ -14,8 +14,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/fmpz_mat.pyx b/src/flint/fmpz_mat.pyx index cbd72e2e..fdbcd957 100644 --- a/src/flint/fmpz_mat.pyx +++ b/src/flint/fmpz_mat.pyx @@ -1,6 +1,7 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck from flint.fmpz cimport fmpz +from flint.fmpz_poly cimport fmpz_poly cdef any_as_fmpz_mat(obj): if typecheck(obj, fmpz_mat): @@ -61,7 +62,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) diff --git a/src/flint/fmpz_mpoly.pyx b/src/flint/fmpz_mpoly.pyx index f94c085d..382a2a84 100644 --- a/src/flint/fmpz_mpoly.pyx +++ b/src/flint/fmpz_mpoly.pyx @@ -3,6 +3,7 @@ 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.fmpz cimport any_as_fmpz cdef any_as_fmpz_mpoly(x): cdef fmpz_mpoly res @@ -47,7 +48,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 +118,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/fmpz_poly.pxd b/src/flint/fmpz_poly.pxd new file mode 100644 index 00000000..a58e39d4 --- /dev/null +++ b/src/flint/fmpz_poly.pxd @@ -0,0 +1,13 @@ + +from flint.flint_base.flint_base cimport flint_poly + +from flint._flint 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/fmpz_poly.pyx index d2f1cbf2..a5a0c300 100644 --- a/src/flint/fmpz_poly.pyx +++ b/src/flint/fmpz_poly.pyx @@ -5,6 +5,18 @@ from flint.flint_base.flint_base cimport flint_poly from flint.utils.typecheck cimport typecheck from flint.fmpz cimport fmpz_set_python from flint.fmpz cimport any_as_fmpz +from flint.fmpz cimport fmpz +from flint.pyflint cimport any_as_fmpq +from flint.pyflint cimport fmpq +from flint.pyflint cimport fmpq_poly +from flint.pyflint cimport any_as_fmpq_poly +from flint.pyflint cimport acb +from flint.pyflint cimport any_as_arb_or_notimplemented +from flint.pyflint cimport arb +from flint.pyflint cimport any_as_acb_or_notimplemented +cimport libc.stdlib + +from flint._flint cimport * cdef any_as_fmpz_poly(x): cdef fmpz_poly res @@ -52,8 +64,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/fmpz_series.pyx b/src/flint/fmpz_series.pyx index bfcbc6a9..26bd028f 100644 --- a/src/flint/fmpz_series.pyx +++ b/src/flint/fmpz_series.pyx @@ -1,5 +1,6 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_series +from flint.fmpz_poly cimport fmpz_poly_set_list cdef fmpz_series_coerce_operands(x, y): if isinstance(y, (int, long, fmpz, fmpz_poly)): @@ -30,8 +31,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/nmod.pyx b/src/flint/nmod.pyx index 0ffaadaf..debe1f66 100644 --- a/src/flint/nmod.pyx +++ b/src/flint/nmod.pyx @@ -34,8 +34,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/nmod_mat.pyx b/src/flint/nmod_mat.pyx index a6d50a7e..cd834514 100644 --- a/src/flint/nmod_mat.pyx +++ b/src/flint/nmod_mat.pyx @@ -21,7 +21,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/nmod_poly.pyx b/src/flint/nmod_poly.pyx index 3f69f6c7..b470c0ef 100644 --- a/src/flint/nmod_poly.pyx +++ b/src/flint/nmod_poly.pyx @@ -55,7 +55,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/pyflint.pxd b/src/flint/pyflint.pxd index 228ff4fc..3830bc03 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -1,87 +1,159 @@ from flint._flint cimport * +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.fmpz cimport fmpz cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 cdef FMPZ_TMP = 2 cdef class Context: - cpdef public bint pretty - cpdef public long prec - cpdef arf_rnd_t rnd + cdef public bint pretty + cdef public long prec + cdef 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 class fmpz: +# cdef fmpz_t val + +#cdef class fmpz_poly: +# cdef fmpz_poly_t val + +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) -cdef class fmpz_series: +cdef class fmpz_series(flint_series): cdef fmpz_poly_t val cdef long prec + cpdef long length(self) + cpdef valuation(self) -cdef class fmpq: +cdef any_as_fmpq(obj) +cdef class fmpq(flint_scalar): cdef fmpq_t val -cdef class fmpq_poly: +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) -cdef class fmpq_mat: +cdef class fmpq_mat(flint_mat): cdef fmpq_mat_t val - -cdef class fmpq_series: + 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) + +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) -cdef class nmod: +cdef class nmod(flint_scalar): cdef mp_limb_t val cdef nmod_t mod -cdef class nmod_poly: +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) 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) -cdef class nmod_series: - cdef nmod_poly_t val - cdef long prec +cdef class nmod_series(flint_series): + pass + # cdef nmod_poly_t val + # cdef long prec cdef class arf: cdef arf_t val - -cdef class arb: + 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) + +cdef any_as_arb_or_notimplemented(x) +cdef class arb(flint_scalar): cdef arb_t val -cdef class acb: + 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) + + +cdef any_as_acb_or_notimplemented(x) +cdef class acb(flint_scalar): cdef acb_t val + cpdef bint is_zero(self) + cpdef bint is_finite(self) + cpdef bint is_exact(self) -cdef class arb_poly: +cdef class arb_poly(flint_poly): cdef arb_poly_t val + cpdef long length(self) + cpdef long degree(self) -cdef class acb_poly: +cdef class acb_poly(flint_poly): cdef acb_poly_t val + cpdef long length(self) + cpdef long degree(self) + -cdef class arb_mat: +cdef class arb_mat(flint_mat): cdef arb_mat_t val + cpdef long nrows(self) + cpdef long ncols(self) -cdef class acb_mat: +cdef class acb_mat(flint_mat): cdef acb_mat_t val + cpdef long nrows(self) + cpdef long ncols(self) -cdef class arb_series: +cdef class arb_series(flint_series): cdef arb_poly_t val cdef long prec + cpdef long length(self) + cpdef valuation(self) -cdef class acb_series: +cdef class acb_series(flint_series): cdef acb_poly_t val cdef long prec + cpdef long length(self) + cpdef valuation(self) cdef class fmpz_mpoly_ctx: cdef fmpz_mpoly_ctx_t val + cpdef slong nvars(self) + + cpdef ordering(self) -cdef class fmpz_mpoly: +cdef class fmpz_mpoly(flint_mpoly): cdef fmpz_mpoly_t val - cdef bint initialized + cdef fmpz_mpoly_ctx ctx + cdef bint _init diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 5279444a..f314b012 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -31,7 +31,7 @@ cdef extern from "Python.h": ctx = thectx #include "fmpz.pyx" -include "fmpz_poly.pyx" +#include "fmpz_poly.pyx" include "fmpz_mpoly.pyx" include "fmpz_mat.pyx" include "fmpz_series.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index a90ec10f..03b0f0a3 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -51,7 +51,7 @@ 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) + failed, total = doctest.testmod(flint.pyflint, verbose=verbose) return failed, total From a9b6969087dcbb449a3bae6062d403acca306948 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Fri, 1 Sep 2023 17:22:26 -0400 Subject: [PATCH 03/39] Modularized fmpz_mat This was straightforward. (The acb doctests are hosed though) --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/fmpq_poly.pyx | 1 + src/flint/fmpz_mat.pxd | 11 +++++++++++ src/flint/fmpz_mat.pyx | 8 ++++++++ src/flint/nmod_mat.pyx | 1 + src/flint/pyflint.pxd | 14 +++++++++----- src/flint/pyflint.pyx | 2 +- src/flint/test/__main__.py | 1 + 9 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 src/flint/fmpz_mat.pxd diff --git a/setup.py b/setup.py index bf86d799..e79bfd7c 100644 --- a/setup.py +++ b/setup.py @@ -69,6 +69,7 @@ # Submodules ("flint.fmpz", ["src/flint/fmpz.pyx"]), ("flint.fmpz_poly", ["src/flint/fmpz_poly.pyx"]), + ("flint.fmpz_mat", ["src/flint/fmpz_mat.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 4916cc10..17e57ad0 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -1,4 +1,5 @@ from .pyflint import * from .fmpz import * from .fmpz_poly import * +from .fmpz_mat import * __version__ = '0.4.2' diff --git a/src/flint/fmpq_poly.pyx b/src/flint/fmpq_poly.pyx index c86dd296..68d9f2c2 100644 --- a/src/flint/fmpq_poly.pyx +++ b/src/flint/fmpq_poly.pyx @@ -1,6 +1,7 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_poly from flint.fmpz_poly cimport any_as_fmpz_poly +from flint.fmpz_poly cimport fmpz_poly cdef any_as_fmpq_poly(obj): if typecheck(obj, fmpq_poly): diff --git a/src/flint/fmpz_mat.pxd b/src/flint/fmpz_mat.pxd new file mode 100644 index 00000000..73d5d742 --- /dev/null +++ b/src/flint/fmpz_mat.pxd @@ -0,0 +1,11 @@ +from flint.flint_base.flint_base cimport flint_mat +from flint._flint cimport fmpz_mat_t +from flint.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/fmpz_mat.pyx index fdbcd957..56877169 100644 --- a/src/flint/fmpz_mat.pyx +++ b/src/flint/fmpz_mat.pyx @@ -2,6 +2,14 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck from flint.fmpz cimport fmpz from flint.fmpz_poly cimport fmpz_poly +from flint.pyflint cimport fmpq_mat +from flint.fmpz cimport any_as_fmpz +from flint.pyflint cimport fmpq +from flint.pyflint cimport global_random_state +from flint.pyflint cimport any_as_fmpq +cimport cython + +from flint._flint cimport * cdef any_as_fmpz_mat(obj): if typecheck(obj, fmpz_mat): diff --git a/src/flint/nmod_mat.pyx b/src/flint/nmod_mat.pyx index cd834514..ddb4f6bc 100644 --- a/src/flint/nmod_mat.pyx +++ b/src/flint/nmod_mat.pyx @@ -1,5 +1,6 @@ from flint.utils.conversion cimport matrix_to_str from flint.utils.typecheck cimport typecheck +from flint.fmpz_mat cimport any_as_fmpz_mat cdef any_as_nmod_mat(obj, nmod_t mod): cdef nmod_mat r diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 3830bc03..d7538baa 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -11,6 +11,9 @@ cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 cdef FMPZ_TMP = 2 + +cdef flint_rand_t global_random_state + cdef class Context: cdef public bint pretty cdef public long prec @@ -25,11 +28,11 @@ cdef class Context: #cdef class fmpz_poly: # cdef fmpz_poly_t val -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) +# 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) cdef class fmpz_series(flint_series): cdef fmpz_poly_t val @@ -47,6 +50,7 @@ cdef class fmpq_poly(flint_poly): cpdef long length(self) cpdef long degree(self) +from flint.fmpz_mat cimport fmpz_mat cdef class fmpq_mat(flint_mat): cdef fmpq_mat_t val cpdef long nrows(self) diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index f314b012..4a7c1bd4 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -33,7 +33,7 @@ ctx = thectx #include "fmpz.pyx" #include "fmpz_poly.pyx" include "fmpz_mpoly.pyx" -include "fmpz_mat.pyx" +#include "fmpz_mat.pyx" include "fmpz_series.pyx" include "fmpq.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index 03b0f0a3..d63f7a84 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -51,6 +51,7 @@ def run_tests(verbose=None): def run_doctests(verbose=None): """Run the python-flint doctests""" # Here verbose=True shows a lot of output. +# ffmpz, tfmpz = doctest.testmod(flint.fmpz, verbose=verbose) failed, total = doctest.testmod(flint.pyflint, verbose=verbose) return failed, total From fee2ba4c95a9fe54c568a287dc9b4eab763f3999 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Fri, 1 Sep 2023 17:46:53 -0400 Subject: [PATCH 04/39] modularized fmpz_series slowly but surely we are advancing --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/fmpq_series.pyx | 1 + src/flint/fmpz_series.pxd | 9 +++++++++ src/flint/fmpz_series.pyx | 15 +++++++++++++++ src/flint/pyflint.pxd | 10 +++++----- src/flint/pyflint.pyx | 2 +- 7 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 src/flint/fmpz_series.pxd diff --git a/setup.py b/setup.py index e79bfd7c..48cae33b 100644 --- a/setup.py +++ b/setup.py @@ -70,6 +70,7 @@ ("flint.fmpz", ["src/flint/fmpz.pyx"]), ("flint.fmpz_poly", ["src/flint/fmpz_poly.pyx"]), ("flint.fmpz_mat", ["src/flint/fmpz_mat.pyx"]), + ("flint.fmpz_series", ["src/flint/fmpz_series.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 17e57ad0..0a5fb4c5 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -2,4 +2,5 @@ from .fmpz import * from .fmpz_poly import * from .fmpz_mat import * +from .fmpz_series import * __version__ = '0.4.2' diff --git a/src/flint/fmpq_series.pyx b/src/flint/fmpq_series.pyx index aa6095ac..23c29f08 100644 --- a/src/flint/fmpq_series.pyx +++ b/src/flint/fmpq_series.pyx @@ -1,5 +1,6 @@ from flint.flint_base.flint_base cimport flint_series from flint.utils.typecheck cimport typecheck +from flint.fmpz_series cimport fmpz_series cdef fmpq_series_coerce_operands(x, y): if isinstance(y, (int, long, fmpz, fmpz_poly, fmpz_series, fmpq, fmpq_poly)): diff --git a/src/flint/fmpz_series.pxd b/src/flint/fmpz_series.pxd new file mode 100644 index 00000000..7a5df67d --- /dev/null +++ b/src/flint/fmpz_series.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_series + +from flint._flint 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/fmpz_series.pyx index 26bd028f..e12c5da1 100644 --- a/src/flint/fmpz_series.pyx +++ b/src/flint/fmpz_series.pyx @@ -1,6 +1,21 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_series from flint.fmpz_poly cimport fmpz_poly_set_list +from flint.fmpz cimport fmpz +from flint.fmpz_poly cimport fmpz_poly +from flint.flint_base.flint_context cimport getcap + +from flint.pyflint cimport fmpq +from flint.pyflint cimport fmpq_poly +from flint.pyflint cimport fmpq_series +from flint.pyflint cimport arb +from flint.pyflint cimport arb_poly +from flint.pyflint cimport arb_series +from flint.pyflint cimport acb +from flint.pyflint cimport acb_poly +from flint.pyflint cimport acb_series + +from flint._flint cimport * cdef fmpz_series_coerce_operands(x, y): if isinstance(y, (int, long, fmpz, fmpz_poly)): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index d7538baa..b6509e6d 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -34,11 +34,11 @@ cdef class Context: # cpdef long ncols(self) # cdef __mul_fmpz(self, fmpz c) -cdef class fmpz_series(flint_series): - cdef fmpz_poly_t val - cdef long prec - cpdef long length(self) - cpdef valuation(self) +# cdef class fmpz_series(flint_series): +# cdef fmpz_poly_t val +# cdef long prec +# cpdef long length(self) +# cpdef valuation(self) cdef any_as_fmpq(obj) cdef class fmpq(flint_scalar): diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 4a7c1bd4..5a30e239 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -34,7 +34,7 @@ ctx = thectx #include "fmpz_poly.pyx" include "fmpz_mpoly.pyx" #include "fmpz_mat.pyx" -include "fmpz_series.pyx" +#include "fmpz_series.pyx" include "fmpq.pyx" include "fmpq_poly.pyx" From 5036787d13c5780d1c8cd75a0f7ebb50993c48e6 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Fri, 1 Sep 2023 22:37:26 -0400 Subject: [PATCH 05/39] Fix up failing doctests For unknown reasons fmpz_mat and fmpq_mat were not being imported into the doctest environment. --- src/flint/acb_mat.pyx | 2 ++ src/flint/arb_mat.pyx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/flint/acb_mat.pyx b/src/flint/acb_mat.pyx index 1cb895f4..99b882cd 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/acb_mat.pyx @@ -518,6 +518,8 @@ 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 >>> A = acb_mat([[1,2],[3,4]]) >>> ((A / 3) * 3).contains(A) True diff --git a/src/flint/arb_mat.pyx b/src/flint/arb_mat.pyx index b0d0f15c..d4e9a8cc 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -595,6 +595,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 From b87de6682c672f5190f38ccc03bc72b2e7cbb5bb Mon Sep 17 00:00:00 2001 From: David Einstein Date: Fri, 1 Sep 2023 23:19:12 -0400 Subject: [PATCH 06/39] modularized fmpq Added fmpq.pxd and rerouted imports --- setup.py | 3 ++- src/flint/__init__.py | 1 + src/flint/acb.pyx | 2 ++ src/flint/arb.pyx | 8 ++++++++ src/flint/fmpq.pxd | 9 +++++++++ src/flint/fmpq.pyx | 5 +++-- src/flint/fmpq_mat.pyx | 2 +- src/flint/fmpq_poly.pyx | 3 +++ src/flint/fmpz_mat.pyx | 2 +- src/flint/fmpz_poly.pyx | 4 ++-- src/flint/pyflint.pxd | 7 ++++--- src/flint/pyflint.pyx | 2 +- 12 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 src/flint/fmpq.pxd diff --git a/setup.py b/setup.py index 48cae33b..3113679e 100644 --- a/setup.py +++ b/setup.py @@ -64,13 +64,14 @@ ext_files = [ - ("flint._flint", ["src/flint/_flint.pxd"]), # Main Module + # ("flint._flint", ["src/flint/_flint.pxd"]), # Main Module ("flint.pyflint", ["src/flint/pyflint.pyx"]), # Main Module # Submodules ("flint.fmpz", ["src/flint/fmpz.pyx"]), ("flint.fmpz_poly", ["src/flint/fmpz_poly.pyx"]), ("flint.fmpz_mat", ["src/flint/fmpz_mat.pyx"]), ("flint.fmpz_series", ["src/flint/fmpz_series.pyx"]), + ("flint.fmpq", ["src/flint/fmpq.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 0a5fb4c5..41dcc9c7 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -3,4 +3,5 @@ from .fmpz_poly import * from .fmpz_mat import * from .fmpz_series import * +from .fmpq import * __version__ = '0.4.2' diff --git a/src/flint/acb.pyx b/src/flint/acb.pyx index e077669e..21a3fde9 100644 --- a/src/flint/acb.pyx +++ b/src/flint/acb.pyx @@ -106,6 +106,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) @@ -2189,6 +2190,7 @@ cdef class acb(flint_scalar): Optionally the regularized hypergeometric function can be computed. + >>> from flint import fmpq >>> 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) diff --git a/src/flint/arb.pyx b/src/flint/arb.pyx index c486042e..c6460967 100644 --- a/src/flint/arb.pyx +++ b/src/flint/arb.pyx @@ -6,6 +6,9 @@ from flint.utils.typecheck cimport typecheck from flint.utils.conversion cimport chars_from_str, str_from_chars, _str_trunc from flint.fmpz cimport fmpz_set_pylong +cdef FMPZ_UNKNOWN = 0 +cdef FMPZ_REF = 1 +cdef FMPZ_TMP = 2 # cdef _str_trunc(s, trunc=0): # if trunc > 0 and len(s) > 3 * trunc: # left = right = trunc @@ -906,6 +909,7 @@ cdef class arb(flint_scalar): r""" Returns the algebraic sine value `\sin(\pi s)`. + >>> from flint import fmpq >>> showgood(lambda: arb.sin_pi_fmpq(fmpq(3,4)), dps=25) 0.7071067811865475244008444 """ @@ -918,6 +922,7 @@ cdef class arb(flint_scalar): r""" Returns the algebraic cosine value `\cos(\pi s)`. + >>> from flint import fmpq >>> showgood(lambda: arb.cos_pi_fmpq(fmpq(3,4)), dps=25) -0.7071067811865475244008444 """ @@ -930,6 +935,7 @@ cdef class arb(flint_scalar): r""" Computes `\sin(\pi s)` and `\cos(\pi s)` simultaneously. + >>> from flint import fmpq >>> showgood(lambda: arb.sin_cos_pi_fmpq(fmpq(3,4)), dps=25) (0.7071067811865475244008444, -0.7071067811865475244008444) """ @@ -1168,6 +1174,7 @@ cdef class arb(flint_scalar): exploiting the fact that *s* is an exact rational number to improve performance. + >>> from flint import fmpq >>> showgood(lambda: arb.gamma_fmpq(fmpq(1,4)), dps=25) 3.625609908221908311930685 """ @@ -1241,6 +1248,7 @@ 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 >>> showgood(lambda: arb.rising_fmpq_ui(fmpq(-1,3), 100), dps=25) -4.960517984074284420131903e+154 """ diff --git a/src/flint/fmpq.pxd b/src/flint/fmpq.pxd new file mode 100644 index 00000000..92e899ff --- /dev/null +++ b/src/flint/fmpq.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_scalar + +from flint._flint 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/fmpq.pyx index a576ee1c..9a5bc60d 100644 --- a/src/flint/fmpq.pyx +++ b/src/flint/fmpq.pyx @@ -1,13 +1,14 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck from flint.fmpz cimport fmpz_set_any_ref - +from flint.fmpz cimport fmpz +from flint.fmpz cimport any_as_fmpz cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 cdef FMPZ_TMP = 2 - +from flint._flint cimport * cdef any_as_fmpq(obj): if typecheck(obj, fmpq): diff --git a/src/flint/fmpq_mat.pyx b/src/flint/fmpq_mat.pyx index 892abbd4..ec02cf7f 100644 --- a/src/flint/fmpq_mat.pyx +++ b/src/flint/fmpq_mat.pyx @@ -11,7 +11,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] diff --git a/src/flint/fmpq_poly.pyx b/src/flint/fmpq_poly.pyx index 68d9f2c2..65614302 100644 --- a/src/flint/fmpq_poly.pyx +++ b/src/flint/fmpq_poly.pyx @@ -2,6 +2,8 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_poly from flint.fmpz_poly cimport any_as_fmpz_poly from flint.fmpz_poly cimport fmpz_poly +from flint.fmpq cimport fmpq +from flint.fmpq cimport any_as_fmpq cdef any_as_fmpq_poly(obj): if typecheck(obj, fmpq_poly): @@ -375,6 +377,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/fmpz_mat.pyx b/src/flint/fmpz_mat.pyx index 56877169..9e6ebf23 100644 --- a/src/flint/fmpz_mat.pyx +++ b/src/flint/fmpz_mat.pyx @@ -6,7 +6,7 @@ from flint.pyflint cimport fmpq_mat from flint.fmpz cimport any_as_fmpz from flint.pyflint cimport fmpq from flint.pyflint cimport global_random_state -from flint.pyflint cimport any_as_fmpq +from flint.fmpq cimport any_as_fmpq cimport cython from flint._flint cimport * diff --git a/src/flint/fmpz_poly.pyx b/src/flint/fmpz_poly.pyx index a5a0c300..463ed898 100644 --- a/src/flint/fmpz_poly.pyx +++ b/src/flint/fmpz_poly.pyx @@ -6,8 +6,8 @@ from flint.utils.typecheck cimport typecheck from flint.fmpz cimport fmpz_set_python from flint.fmpz cimport any_as_fmpz from flint.fmpz cimport fmpz -from flint.pyflint cimport any_as_fmpq -from flint.pyflint cimport fmpq +from flint.fmpq cimport any_as_fmpq +from flint.fmpq cimport fmpq from flint.pyflint cimport fmpq_poly from flint.pyflint cimport any_as_fmpq_poly from flint.pyflint cimport acb diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index b6509e6d..29844659 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -40,9 +40,10 @@ cdef class Context: # cpdef long length(self) # cpdef valuation(self) -cdef any_as_fmpq(obj) -cdef class fmpq(flint_scalar): - cdef fmpq_t val +# cdef any_as_fmpq(obj) +# cdef class fmpq(flint_scalar): +# cdef fmpq_t val +from flint.fmpq cimport fmpq cdef any_as_fmpq_poly(obj) cdef class fmpq_poly(flint_poly): diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 5a30e239..70a018fd 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -36,7 +36,7 @@ include "fmpz_mpoly.pyx" #include "fmpz_mat.pyx" #include "fmpz_series.pyx" -include "fmpq.pyx" +# include "fmpq.pyx" include "fmpq_poly.pyx" include "fmpq_mat.pyx" include "fmpq_series.pyx" From d25f049dd10ece73e4767e5efe7ee5f0772c0a99 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Fri, 1 Sep 2023 23:42:44 -0400 Subject: [PATCH 07/39] Modularized fmpq_poly --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/fmpq_mat.pyx | 4 ++++ src/flint/fmpq_poly.pxd | 9 +++++++++ src/flint/fmpq_poly.pyx | 4 ++++ src/flint/fmpz_poly.pyx | 4 ++-- src/flint/fmpz_series.pyx | 4 ++-- src/flint/nmod_poly.pyx | 2 ++ src/flint/pyflint.pxd | 10 +++++----- src/flint/pyflint.pyx | 2 +- 10 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 src/flint/fmpq_poly.pxd diff --git a/setup.py b/setup.py index 3113679e..1defa600 100644 --- a/setup.py +++ b/setup.py @@ -72,6 +72,7 @@ ("flint.fmpz_mat", ["src/flint/fmpz_mat.pyx"]), ("flint.fmpz_series", ["src/flint/fmpz_series.pyx"]), ("flint.fmpq", ["src/flint/fmpq.pyx"]), + ("flint.fmpq_poly", ["src/flint/fmpq_poly.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 41dcc9c7..e15bc846 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -4,4 +4,5 @@ from .fmpz_mat import * from .fmpz_series import * from .fmpq import * +from .fmpq_poly import * __version__ = '0.4.2' diff --git a/src/flint/fmpq_mat.pyx b/src/flint/fmpq_mat.pyx index ec02cf7f..7ecb06e9 100644 --- a/src/flint/fmpq_mat.pyx +++ b/src/flint/fmpq_mat.pyx @@ -1,5 +1,9 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck +from flint.fmpq_poly cimport fmpq_poly +from flint.fmpq cimport any_as_fmpq +from flint.fmpz_poly cimport fmpz_poly +from flint.fmpq_poly cimport fmpq_poly_set_list cdef any_as_fmpq_mat(obj): if typecheck(obj, fmpq_mat): diff --git a/src/flint/fmpq_poly.pxd b/src/flint/fmpq_poly.pxd new file mode 100644 index 00000000..a83a45d9 --- /dev/null +++ b/src/flint/fmpq_poly.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_poly +from flint._flint 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/fmpq_poly.pyx index 65614302..37efa210 100644 --- a/src/flint/fmpq_poly.pyx +++ b/src/flint/fmpq_poly.pyx @@ -4,6 +4,10 @@ from flint.fmpz_poly cimport any_as_fmpz_poly from flint.fmpz_poly cimport fmpz_poly from flint.fmpq cimport fmpq from flint.fmpq cimport any_as_fmpq +from flint.fmpz cimport fmpz +from flint.fmpz cimport any_as_fmpz + +from flint._flint cimport * cdef any_as_fmpq_poly(obj): if typecheck(obj, fmpq_poly): diff --git a/src/flint/fmpz_poly.pyx b/src/flint/fmpz_poly.pyx index 463ed898..65010934 100644 --- a/src/flint/fmpz_poly.pyx +++ b/src/flint/fmpz_poly.pyx @@ -8,8 +8,8 @@ from flint.fmpz cimport any_as_fmpz from flint.fmpz cimport fmpz from flint.fmpq cimport any_as_fmpq from flint.fmpq cimport fmpq -from flint.pyflint cimport fmpq_poly -from flint.pyflint cimport any_as_fmpq_poly +from flint.fmpq_poly cimport fmpq_poly +from flint.fmpq_poly cimport any_as_fmpq_poly from flint.pyflint cimport acb from flint.pyflint cimport any_as_arb_or_notimplemented from flint.pyflint cimport arb diff --git a/src/flint/fmpz_series.pyx b/src/flint/fmpz_series.pyx index e12c5da1..d59e3bcf 100644 --- a/src/flint/fmpz_series.pyx +++ b/src/flint/fmpz_series.pyx @@ -5,8 +5,8 @@ from flint.fmpz cimport fmpz from flint.fmpz_poly cimport fmpz_poly from flint.flint_base.flint_context cimport getcap -from flint.pyflint cimport fmpq -from flint.pyflint cimport fmpq_poly +from flint.fmpq cimport fmpq +from flint.fmpq_poly cimport fmpq_poly from flint.pyflint cimport fmpq_series from flint.pyflint cimport arb from flint.pyflint cimport arb_poly diff --git a/src/flint/nmod_poly.pyx b/src/flint/nmod_poly.pyx index b470c0ef..900d67c3 100644 --- a/src/flint/nmod_poly.pyx +++ b/src/flint/nmod_poly.pyx @@ -1,5 +1,7 @@ from flint.flint_base.flint_base cimport flint_poly from flint.utils.typecheck cimport typecheck +from flint.fmpz_poly cimport any_as_fmpz_poly +from flint.fmpz_poly cimport fmpz_poly cdef any_as_nmod_poly(obj, nmod_t mod): cdef nmod_poly r diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 29844659..99b2435d 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -45,11 +45,11 @@ cdef class Context: # cdef fmpq_t val from flint.fmpq cimport fmpq -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) +# 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) from flint.fmpz_mat cimport fmpz_mat cdef class fmpq_mat(flint_mat): diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 70a018fd..36583d48 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -37,7 +37,7 @@ include "fmpz_mpoly.pyx" #include "fmpz_series.pyx" # include "fmpq.pyx" -include "fmpq_poly.pyx" +# include "fmpq_poly.pyx" include "fmpq_mat.pyx" include "fmpq_series.pyx" From 3db53a30de60f078c81f483a47af0997895dede1 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 09:04:47 -0400 Subject: [PATCH 08/39] Modularized fmpq_mat All the tests work. The doctests run are diminishing for now --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/arb_mat.pyx | 1 + src/flint/fmpq_mat.pyx | 4 ++++ src/flint/fmpq_series.pyx | 3 ++- src/flint/fmpz_mat.pyx | 4 ++-- src/flint/nmod.pyx | 1 + src/flint/nmod_mat.pyx | 1 + src/flint/pyflint.pxd | 21 +++++++++++---------- src/flint/pyflint.pyx | 2 +- 10 files changed, 25 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index 1defa600..0a48a652 100644 --- a/setup.py +++ b/setup.py @@ -73,6 +73,7 @@ ("flint.fmpz_series", ["src/flint/fmpz_series.pyx"]), ("flint.fmpq", ["src/flint/fmpq.pyx"]), ("flint.fmpq_poly", ["src/flint/fmpq_poly.pyx"]), + ("flint.fmpq_mat", ["src/flint/fmpq_mat.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 e15bc846..071729ca 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -5,4 +5,5 @@ from .fmpz_series import * from .fmpq import * from .fmpq_poly import * +from .fmpq_mat import * __version__ = '0.4.2' diff --git a/src/flint/arb_mat.pyx b/src/flint/arb_mat.pyx index d4e9a8cc..0ecd47a2 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -1,6 +1,7 @@ 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.fmpq_mat cimport fmpq_mat cdef arb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat)): diff --git a/src/flint/fmpq_mat.pyx b/src/flint/fmpq_mat.pyx index 7ecb06e9..2ae7c2e4 100644 --- a/src/flint/fmpq_mat.pyx +++ b/src/flint/fmpq_mat.pyx @@ -4,6 +4,10 @@ from flint.fmpq_poly cimport fmpq_poly from flint.fmpq cimport any_as_fmpq from flint.fmpz_poly cimport fmpz_poly from flint.fmpq_poly cimport fmpq_poly_set_list +from flint.fmpz cimport any_as_fmpz + +from flint._flint cimport * +cimport cython cdef any_as_fmpq_mat(obj): if typecheck(obj, fmpq_mat): diff --git a/src/flint/fmpq_series.pyx b/src/flint/fmpq_series.pyx index 23c29f08..ec6f2184 100644 --- a/src/flint/fmpq_series.pyx +++ b/src/flint/fmpq_series.pyx @@ -1,7 +1,8 @@ from flint.flint_base.flint_base cimport flint_series from flint.utils.typecheck cimport typecheck from flint.fmpz_series cimport fmpz_series - +from flint.fmpq_poly cimport fmpq_poly +from flint.fmpq_poly cimport fmpq_poly_set_list cdef fmpq_series_coerce_operands(x, y): if isinstance(y, (int, long, fmpz, fmpz_poly, fmpz_series, fmpq, fmpq_poly)): return x, fmpq_series(y) diff --git a/src/flint/fmpz_mat.pyx b/src/flint/fmpz_mat.pyx index 9e6ebf23..48828735 100644 --- a/src/flint/fmpz_mat.pyx +++ b/src/flint/fmpz_mat.pyx @@ -2,9 +2,9 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck from flint.fmpz cimport fmpz from flint.fmpz_poly cimport fmpz_poly -from flint.pyflint cimport fmpq_mat +from flint.fmpq_mat cimport fmpq_mat from flint.fmpz cimport any_as_fmpz -from flint.pyflint cimport fmpq +from flint.fmpq cimport fmpq from flint.pyflint cimport global_random_state from flint.fmpq cimport any_as_fmpq cimport cython diff --git a/src/flint/nmod.pyx b/src/flint/nmod.pyx index debe1f66..1aa78b3f 100644 --- a/src/flint/nmod.pyx +++ b/src/flint/nmod.pyx @@ -1,5 +1,6 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck +from flint.fmpq cimport any_as_fmpq cdef int any_as_nmod(mp_limb_t * val, obj, nmod_t mod) except -1: cdef int success diff --git a/src/flint/nmod_mat.pyx b/src/flint/nmod_mat.pyx index ddb4f6bc..ec9ed9f3 100644 --- a/src/flint/nmod_mat.pyx +++ b/src/flint/nmod_mat.pyx @@ -1,6 +1,7 @@ from flint.utils.conversion cimport matrix_to_str from flint.utils.typecheck cimport typecheck from flint.fmpz_mat cimport any_as_fmpz_mat +from flint.fmpz_mat cimport fmpz_mat cdef any_as_nmod_mat(obj, nmod_t mod): cdef nmod_mat r diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 99b2435d..bc65a257 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -6,6 +6,7 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.flint_base.flint_base cimport flint_poly from flint.fmpz cimport fmpz +from flint._flint cimport * cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 @@ -51,16 +52,16 @@ from flint.fmpq cimport fmpq # cpdef long length(self) # cpdef long degree(self) -from flint.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) +# from flint.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) cdef class fmpq_series(flint_series): cdef fmpq_poly_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 36583d48..2bf538b3 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -38,7 +38,7 @@ include "fmpz_mpoly.pyx" # include "fmpq.pyx" # include "fmpq_poly.pyx" -include "fmpq_mat.pyx" +# include "fmpq_mat.pyx" include "fmpq_series.pyx" include "nmod.pyx" From 697ab23d9c1308409816a2333270698d9c1fbbce Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 09:28:06 -0400 Subject: [PATCH 09/39] Modularized fmpq_series --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/arb_poly.pyx | 1 + src/flint/arb_series.pyx | 2 ++ src/flint/fmpq_mat.pxd | 17 +++++++++++++++++ src/flint/fmpq_series.pxd | 10 ++++++++++ src/flint/fmpq_series.pyx | 14 ++++++++++++++ src/flint/fmpz_series.pyx | 2 +- src/flint/pyflint.pxd | 14 +++++++------- src/flint/pyflint.pyx | 2 +- 10 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 src/flint/fmpq_mat.pxd create mode 100644 src/flint/fmpq_series.pxd diff --git a/setup.py b/setup.py index 0a48a652..ae5edd74 100644 --- a/setup.py +++ b/setup.py @@ -74,6 +74,7 @@ ("flint.fmpq", ["src/flint/fmpq.pyx"]), ("flint.fmpq_poly", ["src/flint/fmpq_poly.pyx"]), ("flint.fmpq_mat", ["src/flint/fmpq_mat.pyx"]), + ("flint.fmpq_series", ["src/flint/fmpq_series.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 071729ca..714ce4dc 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -6,4 +6,5 @@ from .fmpq import * from .fmpq_poly import * from .fmpq_mat import * +from .fmpq_series import * __version__ = '0.4.2' diff --git a/src/flint/arb_poly.pyx b/src/flint/arb_poly.pyx index 66622fb3..bd10d563 100644 --- a/src/flint/arb_poly.pyx +++ b/src/flint/arb_poly.pyx @@ -1,6 +1,7 @@ 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.fmpq_poly cimport fmpq_poly cdef arb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, fmpz, fmpq, arb, fmpz_poly, fmpq_poly)): diff --git a/src/flint/arb_series.pyx b/src/flint/arb_series.pyx index 1a836fb5..1da4ebe5 100644 --- a/src/flint/arb_series.pyx +++ b/src/flint/arb_series.pyx @@ -1,6 +1,8 @@ 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.fmpz_series cimport fmpz_series +from flint.fmpq_series cimport fmpq_series 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)): diff --git a/src/flint/fmpq_mat.pxd b/src/flint/fmpq_mat.pxd new file mode 100644 index 00000000..5960ae79 --- /dev/null +++ b/src/flint/fmpq_mat.pxd @@ -0,0 +1,17 @@ +from flint.flint_base.flint_base cimport flint_mat + +from flint._flint cimport fmpq_mat_t +from flint.fmpz cimport fmpz +from flint.fmpq cimport fmpq +from flint.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_series.pxd b/src/flint/fmpq_series.pxd new file mode 100644 index 00000000..7aa92929 --- /dev/null +++ b/src/flint/fmpq_series.pxd @@ -0,0 +1,10 @@ +from flint.flint_base.flint_base cimport flint_series +from flint._flint 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/fmpq_series.pyx index ec6f2184..5cb3af67 100644 --- a/src/flint/fmpq_series.pyx +++ b/src/flint/fmpq_series.pyx @@ -3,6 +3,20 @@ from flint.utils.typecheck cimport typecheck from flint.fmpz_series cimport fmpz_series from flint.fmpq_poly cimport fmpq_poly from flint.fmpq_poly cimport fmpq_poly_set_list +from flint.fmpz cimport fmpz +from flint.fmpz_poly cimport fmpz_poly +from flint.fmpq cimport fmpq +from flint.pyflint cimport arb +from flint.pyflint cimport arb_poly +from flint.pyflint cimport arb_series +from flint.pyflint cimport acb +from flint.pyflint cimport acb_poly +from flint.pyflint cimport acb_series +from flint.flint_base.flint_context cimport getcap +from flint.fmpz cimport any_as_fmpz + +from flint._flint cimport * + cdef fmpq_series_coerce_operands(x, y): if isinstance(y, (int, long, fmpz, fmpz_poly, fmpz_series, fmpq, fmpq_poly)): return x, fmpq_series(y) diff --git a/src/flint/fmpz_series.pyx b/src/flint/fmpz_series.pyx index d59e3bcf..7aa40fa9 100644 --- a/src/flint/fmpz_series.pyx +++ b/src/flint/fmpz_series.pyx @@ -7,7 +7,7 @@ from flint.flint_base.flint_context cimport getcap from flint.fmpq cimport fmpq from flint.fmpq_poly cimport fmpq_poly -from flint.pyflint cimport fmpq_series +from flint.fmpq_series cimport fmpq_series from flint.pyflint cimport arb from flint.pyflint cimport arb_poly from flint.pyflint cimport arb_series diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index bc65a257..4792dc17 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -63,13 +63,13 @@ from flint.fmpq cimport fmpq # cdef __mul_fmpz_mat(self, fmpz_mat other) # cdef __mul_r_fmpz_mat(self, fmpz_mat other) -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) +# 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) cdef class nmod(flint_scalar): cdef mp_limb_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 2bf538b3..1bf8fb58 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -39,7 +39,7 @@ include "fmpz_mpoly.pyx" # include "fmpq.pyx" # include "fmpq_poly.pyx" # include "fmpq_mat.pyx" -include "fmpq_series.pyx" +# include "fmpq_series.pyx" include "nmod.pyx" include "nmod_poly.pyx" From 175285c01daa124bc35b86da7d77eb6cad03add7 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 11:00:33 -0400 Subject: [PATCH 10/39] Modularized nmod --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/nmod.pxd | 9 +++++++++ src/flint/nmod.pyx | 5 +++++ src/flint/nmod_poly.pyx | 2 ++ src/flint/pyflint.pxd | 6 +++--- src/flint/pyflint.pyx | 2 +- 7 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 src/flint/nmod.pxd diff --git a/setup.py b/setup.py index ae5edd74..9e6b32d7 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ ("flint.fmpq_poly", ["src/flint/fmpq_poly.pyx"]), ("flint.fmpq_mat", ["src/flint/fmpq_mat.pyx"]), ("flint.fmpq_series", ["src/flint/fmpq_series.pyx"]), + ("flint.nmod", ["src/flint/nmod.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 714ce4dc..d59f659c 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -7,4 +7,5 @@ from .fmpq_poly import * from .fmpq_mat import * from .fmpq_series import * +from .nmod import * __version__ = '0.4.2' diff --git a/src/flint/nmod.pxd b/src/flint/nmod.pxd new file mode 100644 index 00000000..4ece832b --- /dev/null +++ b/src/flint/nmod.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_scalar +from flint._flint cimport mp_limb_t +from flint._flint 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/nmod.pyx index 1aa78b3f..1990d0a3 100644 --- a/src/flint/nmod.pyx +++ b/src/flint/nmod.pyx @@ -1,6 +1,11 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck from flint.fmpq cimport any_as_fmpq +from flint.fmpz cimport any_as_fmpz +from flint.fmpz cimport fmpz +from flint.fmpq cimport fmpq + +from flint._flint cimport * cdef int any_as_nmod(mp_limb_t * val, obj, nmod_t mod) except -1: cdef int success diff --git a/src/flint/nmod_poly.pyx b/src/flint/nmod_poly.pyx index 900d67c3..2e7ddf9f 100644 --- a/src/flint/nmod_poly.pyx +++ b/src/flint/nmod_poly.pyx @@ -2,6 +2,8 @@ from flint.flint_base.flint_base cimport flint_poly from flint.utils.typecheck cimport typecheck from flint.fmpz_poly cimport any_as_fmpz_poly from flint.fmpz_poly cimport fmpz_poly +from flint.nmod cimport any_as_nmod +from flint.nmod cimport nmod cdef any_as_nmod_poly(obj, nmod_t mod): cdef nmod_poly r diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 4792dc17..006df1cf 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -71,9 +71,9 @@ from flint.fmpq cimport fmpq # cdef bint zero_constant_term(s) # cdef bint one_constant_term(s) -cdef class nmod(flint_scalar): - cdef mp_limb_t val - cdef nmod_t mod +# cdef class nmod(flint_scalar): +# cdef mp_limb_t val +# cdef nmod_t mod cdef class nmod_poly(flint_poly): cdef nmod_poly_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 1bf8fb58..869d31bd 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -41,7 +41,7 @@ include "fmpz_mpoly.pyx" # include "fmpq_mat.pyx" # include "fmpq_series.pyx" -include "nmod.pyx" +#include "nmod.pyx" include "nmod_poly.pyx" include "nmod_mat.pyx" include "nmod_series.pyx" From da2d8cd8bea0c10fbd4baf250720fa64cb1650bb Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 11:15:38 -0400 Subject: [PATCH 11/39] modularize nmod_poly --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/arb_poly.pyx | 1 + src/flint/nmod_mat.pyx | 2 ++ src/flint/nmod_poly.pxd | 10 ++++++++++ src/flint/nmod_poly.pyx | 2 ++ src/flint/pyflint.pxd | 10 +++++----- src/flint/pyflint.pyx | 12 ++++++------ 8 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 src/flint/nmod_poly.pxd diff --git a/setup.py b/setup.py index 9e6b32d7..61e6a4d8 100644 --- a/setup.py +++ b/setup.py @@ -76,6 +76,7 @@ ("flint.fmpq_mat", ["src/flint/fmpq_mat.pyx"]), ("flint.fmpq_series", ["src/flint/fmpq_series.pyx"]), ("flint.nmod", ["src/flint/nmod.pyx"]), + ("flint.nmod_poly", ["src/flint/nmod_poly.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 d59f659c..c8804c29 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -8,4 +8,5 @@ from .fmpq_mat import * from .fmpq_series import * from .nmod import * +from .nmod_poly import * __version__ = '0.4.2' diff --git a/src/flint/arb_poly.pyx b/src/flint/arb_poly.pyx index bd10d563..1aec4ccf 100644 --- a/src/flint/arb_poly.pyx +++ b/src/flint/arb_poly.pyx @@ -2,6 +2,7 @@ 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.fmpq_poly cimport fmpq_poly +from flint.fmpz_poly cimport fmpz_poly cdef arb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, fmpz, fmpq, arb, fmpz_poly, fmpq_poly)): diff --git a/src/flint/nmod_mat.pyx b/src/flint/nmod_mat.pyx index ec9ed9f3..1cbb77b9 100644 --- a/src/flint/nmod_mat.pyx +++ b/src/flint/nmod_mat.pyx @@ -2,6 +2,8 @@ from flint.utils.conversion cimport matrix_to_str from flint.utils.typecheck cimport typecheck from flint.fmpz_mat cimport any_as_fmpz_mat from flint.fmpz_mat cimport fmpz_mat +from flint.nmod cimport nmod +from flint.nmod cimport any_as_nmod cdef any_as_nmod_mat(obj, nmod_t mod): cdef nmod_mat r diff --git a/src/flint/nmod_poly.pxd b/src/flint/nmod_poly.pxd new file mode 100644 index 00000000..1bf91747 --- /dev/null +++ b/src/flint/nmod_poly.pxd @@ -0,0 +1,10 @@ +from flint.flint_base.flint_base cimport flint_poly + +from flint._flint 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/nmod_poly.pyx index 2e7ddf9f..51453f3f 100644 --- a/src/flint/nmod_poly.pyx +++ b/src/flint/nmod_poly.pyx @@ -5,6 +5,8 @@ from flint.fmpz_poly cimport fmpz_poly from flint.nmod cimport any_as_nmod from flint.nmod cimport nmod +from flint._flint cimport * + cdef any_as_nmod_poly(obj, nmod_t mod): cdef nmod_poly r cdef mp_limb_t v diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 006df1cf..5cc6edc4 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -75,11 +75,11 @@ from flint.fmpq cimport fmpq # cdef mp_limb_t val # cdef nmod_t mod -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) +# 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) cdef class nmod_mat: cdef nmod_mat_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 869d31bd..6f85075f 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -30,19 +30,19 @@ cdef extern from "Python.h": ctx = thectx -#include "fmpz.pyx" -#include "fmpz_poly.pyx" +# include "fmpz.pyx" +# include "fmpz_poly.pyx" include "fmpz_mpoly.pyx" -#include "fmpz_mat.pyx" -#include "fmpz_series.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.pyx" +# include "nmod_poly.pyx" include "nmod_mat.pyx" include "nmod_series.pyx" From 253625b41b4acd1204ebe7292e08f4014f7fedb9 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 12:39:59 -0400 Subject: [PATCH 12/39] Modularized nmod_mat and nmod_series nmod_series is just a stub --- setup.py | 2 ++ src/flint/__init__.py | 2 ++ src/flint/arb_mat.pyx | 1 + src/flint/nmod_mat.pxd | 11 +++++++++++ src/flint/nmod_mat.pyx | 8 ++++++++ src/flint/nmod_series.pxd | 4 ++++ src/flint/pyflint.pxd | 16 ++++++++-------- src/flint/pyflint.pyx | 4 ++-- 8 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 src/flint/nmod_mat.pxd create mode 100644 src/flint/nmod_series.pxd diff --git a/setup.py b/setup.py index 61e6a4d8..c4761c95 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,8 @@ ("flint.fmpq_series", ["src/flint/fmpq_series.pyx"]), ("flint.nmod", ["src/flint/nmod.pyx"]), ("flint.nmod_poly", ["src/flint/nmod_poly.pyx"]), + ("flint.nmod_mat", ["src/flint/nmod_mat.pyx"]), + ("flint.nmod_series", ["src/flint/nmod_series.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 c8804c29..bdaf96d0 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -9,4 +9,6 @@ from .fmpq_series import * from .nmod import * from .nmod_poly import * +from .nmod_mat import * +from .nmod_series import * __version__ = '0.4.2' diff --git a/src/flint/arb_mat.pyx b/src/flint/arb_mat.pyx index 0ecd47a2..9e3e8d39 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -2,6 +2,7 @@ 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.fmpq_mat cimport fmpq_mat +from flint.fmpz_mat cimport fmpz_mat cdef arb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat)): diff --git a/src/flint/nmod_mat.pxd b/src/flint/nmod_mat.pxd new file mode 100644 index 00000000..d7c0e1c1 --- /dev/null +++ b/src/flint/nmod_mat.pxd @@ -0,0 +1,11 @@ +from flint.flint_base.flint_base cimport flint_mat + +from flint._flint 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/nmod_mat.pyx index 1cbb77b9..5d3507c4 100644 --- a/src/flint/nmod_mat.pyx +++ b/src/flint/nmod_mat.pyx @@ -4,6 +4,14 @@ from flint.fmpz_mat cimport any_as_fmpz_mat from flint.fmpz_mat cimport fmpz_mat from flint.nmod cimport nmod from flint.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 * + +ctx = thectx cdef any_as_nmod_mat(obj, nmod_t mod): cdef nmod_mat r diff --git a/src/flint/nmod_series.pxd b/src/flint/nmod_series.pxd new file mode 100644 index 00000000..613a97c9 --- /dev/null +++ b/src/flint/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/pyflint.pxd b/src/flint/pyflint.pxd index 5cc6edc4..7341ed0f 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -81,15 +81,15 @@ from flint.fmpq cimport fmpq # cpdef long degree(self) # cpdef mp_limb_t modulus(self) -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) +# 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) -cdef class nmod_series(flint_series): - pass +# cdef class nmod_series(flint_series): +# pass # cdef nmod_poly_t val # cdef long prec diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 6f85075f..96a003a3 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -43,8 +43,8 @@ include "fmpz_mpoly.pyx" # include "nmod.pyx" # include "nmod_poly.pyx" -include "nmod_mat.pyx" -include "nmod_series.pyx" +# include "nmod_mat.pyx" +# include "nmod_series.pyx" include "arf.pyx" include "arb.pyx" From a8ade5ba8b13eadbe943da2e2a7fe4c124cf5bdf Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 12:58:10 -0400 Subject: [PATCH 13/39] Modularized arf --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/arb.pyx | 1 + src/flint/arf.pxd | 9 +++++++++ src/flint/arf.pyx | 8 ++++++++ src/flint/pyflint.pxd | 14 +++++++------- src/flint/pyflint.pyx | 2 +- 7 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/flint/arf.pxd diff --git a/setup.py b/setup.py index c4761c95..eef98508 100644 --- a/setup.py +++ b/setup.py @@ -79,6 +79,7 @@ ("flint.nmod_poly", ["src/flint/nmod_poly.pyx"]), ("flint.nmod_mat", ["src/flint/nmod_mat.pyx"]), ("flint.nmod_series", ["src/flint/nmod_series.pyx"]), + ("flint.arf", ["src/flint/arf.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 bdaf96d0..39adac59 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -11,4 +11,5 @@ from .nmod_poly import * from .nmod_mat import * from .nmod_series import * +from .arf import * __version__ = '0.4.2' diff --git a/src/flint/arb.pyx b/src/flint/arb.pyx index c6460967..677264b6 100644 --- a/src/flint/arb.pyx +++ b/src/flint/arb.pyx @@ -5,6 +5,7 @@ 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, _str_trunc from flint.fmpz cimport fmpz_set_pylong +from flint.arf cimport arf cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 diff --git a/src/flint/arf.pxd b/src/flint/arf.pxd new file mode 100644 index 00000000..4ef65d9c --- /dev/null +++ b/src/flint/arf.pxd @@ -0,0 +1,9 @@ +from flint._flint 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/arf.pyx index 342e655b..307782cc 100644 --- a/src/flint/arf.pyx +++ b/src/flint/arf.pyx @@ -1,6 +1,14 @@ 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.fmpz cimport fmpz +from flint.fmpz cimport any_as_fmpz +from flint.pyflint cimport arb + +from flint._flint cimport * + +ctx = thectx cdef class arf: diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 7341ed0f..bc9acd7a 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -93,13 +93,13 @@ from flint.fmpq cimport fmpq # cdef nmod_poly_t val # cdef long prec -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) +# 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) cdef any_as_arb_or_notimplemented(x) cdef class arb(flint_scalar): diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 96a003a3..238a33de 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -46,7 +46,7 @@ include "fmpz_mpoly.pyx" # include "nmod_mat.pyx" # include "nmod_series.pyx" -include "arf.pyx" +# include "arf.pyx" include "arb.pyx" include "arb_poly.pyx" include "arb_mat.pyx" From 353ba9578082f65c92e1edc71b5d65836317f8da Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 14:47:05 -0400 Subject: [PATCH 14/39] Modularized arb The light at the end of the tunnel appears --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/acb.pyx | 8 ++++++++ src/flint/arb.pxd | 17 +++++++++++++++++ src/flint/arb.pyx | 12 +++++++++++- src/flint/arb_mat.pyx | 1 + src/flint/arb_poly.pyx | 2 ++ src/flint/arf.pyx | 2 +- src/flint/fmpq_series.pyx | 2 +- src/flint/fmpz_poly.pyx | 4 ++-- src/flint/fmpz_series.pyx | 2 +- src/flint/functions.pyx | 2 ++ src/flint/pyflint.pxd | 16 ++++++++-------- src/flint/pyflint.pyx | 2 +- 14 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 src/flint/arb.pxd diff --git a/setup.py b/setup.py index eef98508..0a7a108e 100644 --- a/setup.py +++ b/setup.py @@ -80,6 +80,7 @@ ("flint.nmod_mat", ["src/flint/nmod_mat.pyx"]), ("flint.nmod_series", ["src/flint/nmod_series.pyx"]), ("flint.arf", ["src/flint/arf.pyx"]), + ("flint.arb", ["src/flint/arb.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 39adac59..41214bca 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -12,4 +12,5 @@ from .nmod_mat import * from .nmod_series import * from .arf import * +from .arb import * __version__ = '0.4.2' diff --git a/src/flint/acb.pyx b/src/flint/acb.pyx index 21a3fde9..c541a66d 100644 --- a/src/flint/acb.pyx +++ b/src/flint/acb.pyx @@ -1,6 +1,11 @@ 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.arb cimport arb_set_mpmath_mpf + +cdef FMPZ_UNKNOWN = 0 +cdef FMPZ_REF = 1 +cdef FMPZ_TMP = 2 cdef int acb_set_python(acb_t x, obj, bint allow_conversion): cdef double re, im @@ -647,6 +652,7 @@ 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 >>> 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) @@ -1395,6 +1401,7 @@ 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 >>> 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) @@ -2434,6 +2441,7 @@ 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 >>> 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) diff --git a/src/flint/arb.pxd b/src/flint/arb.pxd new file mode 100644 index 00000000..ec18a499 --- /dev/null +++ b/src/flint/arb.pxd @@ -0,0 +1,17 @@ +from flint.flint_base.flint_base cimport flint_scalar + +from flint._flint 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/arb.pyx index 677264b6..c0649598 100644 --- a/src/flint/arb.pyx +++ b/src/flint/arb.pyx @@ -1,11 +1,20 @@ from cpython.version cimport PY_MAJOR_VERSION 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, _str_trunc from flint.fmpz cimport fmpz_set_pylong from flint.arf cimport arf +from flint.fmpq cimport fmpq +from flint.fmpz cimport fmpz + +from flint._flint cimport * +cimport libc.stdlib +cimport cython + +ctx = thectx cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 @@ -129,7 +138,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 @@ -2464,3 +2473,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/arb_mat.pyx b/src/flint/arb_mat.pyx index 9e3e8d39..fce67971 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -3,6 +3,7 @@ from flint.flint_base.flint_context cimport getprec from flint.flint_base.flint_base cimport flint_mat from flint.fmpq_mat cimport fmpq_mat from flint.fmpz_mat cimport fmpz_mat +from flint.arb cimport arb cdef arb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat)): diff --git a/src/flint/arb_poly.pyx b/src/flint/arb_poly.pyx index 1aec4ccf..014e0480 100644 --- a/src/flint/arb_poly.pyx +++ b/src/flint/arb_poly.pyx @@ -3,6 +3,8 @@ from flint.flint_base.flint_context cimport getprec from flint.flint_base.flint_base cimport flint_poly from flint.fmpq_poly cimport fmpq_poly from flint.fmpz_poly cimport fmpz_poly +from flint.arb cimport arb_set_python +from flint.arb cimport any_as_arb cdef arb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, fmpz, fmpq, arb, fmpz_poly, fmpq_poly)): diff --git a/src/flint/arf.pyx b/src/flint/arf.pyx index 307782cc..1464ba14 100644 --- a/src/flint/arf.pyx +++ b/src/flint/arf.pyx @@ -4,7 +4,7 @@ from flint.utils.typecheck cimport typecheck from flint.utils.conversion cimport prec_to_dps from flint.fmpz cimport fmpz from flint.fmpz cimport any_as_fmpz -from flint.pyflint cimport arb +from flint.arb cimport arb from flint._flint cimport * diff --git a/src/flint/fmpq_series.pyx b/src/flint/fmpq_series.pyx index 5cb3af67..3299aab6 100644 --- a/src/flint/fmpq_series.pyx +++ b/src/flint/fmpq_series.pyx @@ -6,7 +6,7 @@ from flint.fmpq_poly cimport fmpq_poly_set_list from flint.fmpz cimport fmpz from flint.fmpz_poly cimport fmpz_poly from flint.fmpq cimport fmpq -from flint.pyflint cimport arb +from flint.arb cimport arb from flint.pyflint cimport arb_poly from flint.pyflint cimport arb_series from flint.pyflint cimport acb diff --git a/src/flint/fmpz_poly.pyx b/src/flint/fmpz_poly.pyx index 65010934..98cb7300 100644 --- a/src/flint/fmpz_poly.pyx +++ b/src/flint/fmpz_poly.pyx @@ -11,8 +11,8 @@ from flint.fmpq cimport fmpq from flint.fmpq_poly cimport fmpq_poly from flint.fmpq_poly cimport any_as_fmpq_poly from flint.pyflint cimport acb -from flint.pyflint cimport any_as_arb_or_notimplemented -from flint.pyflint cimport arb +from flint.arb cimport any_as_arb_or_notimplemented +from flint.arb cimport arb from flint.pyflint cimport any_as_acb_or_notimplemented cimport libc.stdlib diff --git a/src/flint/fmpz_series.pyx b/src/flint/fmpz_series.pyx index 7aa40fa9..49422d27 100644 --- a/src/flint/fmpz_series.pyx +++ b/src/flint/fmpz_series.pyx @@ -8,7 +8,7 @@ from flint.flint_base.flint_context cimport getcap from flint.fmpq cimport fmpq from flint.fmpq_poly cimport fmpq_poly from flint.fmpq_series cimport fmpq_series -from flint.pyflint cimport arb +from flint.arb cimport arb from flint.pyflint cimport arb_poly from flint.pyflint cimport arb_series from flint.pyflint cimport acb diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 7bb8e6a4..582db087 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -33,6 +33,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): ... @@ -107,6 +108,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 bc9acd7a..9b0986fd 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -101,15 +101,15 @@ from flint.fmpq cimport fmpq # cpdef bint is_nan(self) # cpdef bint is_zero(self) -cdef any_as_arb_or_notimplemented(x) -cdef class arb(flint_scalar): - cdef arb_t val +# cdef any_as_arb_or_notimplemented(x) +# 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) +# 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) cdef any_as_acb_or_notimplemented(x) diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 238a33de..55c5a3e5 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -47,7 +47,7 @@ include "fmpz_mpoly.pyx" # include "nmod_series.pyx" # include "arf.pyx" -include "arb.pyx" +# include "arb.pyx" include "arb_poly.pyx" include "arb_mat.pyx" include "arb_series.pyx" From e5f6406d0849d8f799ce75f2adff104ba131f781 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 20:08:54 -0400 Subject: [PATCH 15/39] Fixed up doctests Although this change sounds trivial, and mostly is, it involves changing the module names so that they do not conflict with the names or the enclosed classes, thereby managing to touch almost everything. The other minor change is importing newly separated modules into the doctests that need them. --- setup.py | 28 ++--- src/flint/__init__.py | 28 ++--- src/flint/{arb.pxd => _arb.pxd} | 0 src/flint/{arb.pyx => _arb.pyx} | 119 +++++++++++++++++- src/flint/{arf.pxd => _arf.pxd} | 0 src/flint/{arf.pyx => _arf.pyx} | 6 +- src/flint/{fmpq.pxd => _fmpq.pxd} | 0 src/flint/{fmpq.pyx => _fmpq.pyx} | 6 +- src/flint/{fmpq_mat.pxd => _fmpq_mat.pxd} | 6 +- src/flint/{fmpq_mat.pyx => _fmpq_mat.pyx} | 10 +- src/flint/{fmpq_poly.pxd => _fmpq_poly.pxd} | 0 src/flint/{fmpq_poly.pyx => _fmpq_poly.pyx} | 13 +- .../{fmpq_series.pxd => _fmpq_series.pxd} | 0 .../{fmpq_series.pyx => _fmpq_series.pyx} | 16 +-- src/flint/{fmpz.pxd => _fmpz.pxd} | 0 src/flint/{fmpz.pyx => _fmpz.pyx} | 2 +- src/flint/{fmpz_mat.pxd => _fmpz_mat.pxd} | 2 +- src/flint/{fmpz_mat.pyx => _fmpz_mat.pyx} | 14 ++- src/flint/{fmpz_poly.pxd => _fmpz_poly.pxd} | 0 src/flint/{fmpz_poly.pyx => _fmpz_poly.pyx} | 18 +-- .../{fmpz_series.pxd => _fmpz_series.pxd} | 0 .../{fmpz_series.pyx => _fmpz_series.pyx} | 14 +-- src/flint/{nmod.pxd => _nmod.pxd} | 0 src/flint/{nmod.pyx => _nmod.pyx} | 8 +- src/flint/{nmod_mat.pxd => _nmod_mat.pxd} | 0 src/flint/{nmod_mat.pyx => _nmod_mat.pyx} | 8 +- src/flint/{nmod_poly.pxd => _nmod_poly.pxd} | 0 src/flint/{nmod_poly.pyx => _nmod_poly.pyx} | 9 +- .../{nmod_series.pxd => _nmod_series.pxd} | 0 .../{nmod_series.pyx => _nmod_series.pyx} | 0 src/flint/acb.pyx | 2 +- src/flint/arb_mat.pyx | 6 +- src/flint/arb_poly.pyx | 8 +- src/flint/arb_series.pyx | 4 +- src/flint/fmpz_mpoly.pyx | 2 +- src/flint/pyflint.pxd | 4 +- src/flint/test/__main__.py | 22 +++- 37 files changed, 243 insertions(+), 112 deletions(-) rename src/flint/{arb.pxd => _arb.pxd} (100%) rename src/flint/{arb.pyx => _arb.pyx} (94%) rename src/flint/{arf.pxd => _arf.pxd} (100%) rename src/flint/{arf.pyx => _arf.pyx} (98%) rename src/flint/{fmpq.pxd => _fmpq.pxd} (100%) rename src/flint/{fmpq.pyx => _fmpq.pyx} (99%) rename src/flint/{fmpq_mat.pxd => _fmpq_mat.pxd} (80%) rename src/flint/{fmpq_mat.pyx => _fmpq_mat.pyx} (98%) rename src/flint/{fmpq_poly.pxd => _fmpq_poly.pxd} (100%) rename src/flint/{fmpq_poly.pyx => _fmpq_poly.pyx} (98%) rename src/flint/{fmpq_series.pxd => _fmpq_series.pxd} (100%) rename src/flint/{fmpq_series.pyx => _fmpq_series.pyx} (98%) rename src/flint/{fmpz.pxd => _fmpz.pxd} (100%) rename src/flint/{fmpz.pyx => _fmpz.pyx} (99%) rename src/flint/{fmpz_mat.pxd => _fmpz_mat.pxd} (89%) rename src/flint/{fmpz_mat.pyx => _fmpz_mat.pyx} (98%) rename src/flint/{fmpz_poly.pxd => _fmpz_poly.pxd} (100%) rename src/flint/{fmpz_poly.pyx => _fmpz_poly.pyx} (98%) rename src/flint/{fmpz_series.pxd => _fmpz_series.pxd} (100%) rename src/flint/{fmpz_series.pyx => _fmpz_series.pyx} (97%) rename src/flint/{nmod.pxd => _nmod.pxd} (100%) rename src/flint/{nmod.pyx => _nmod.pyx} (97%) rename src/flint/{nmod_mat.pxd => _nmod_mat.pxd} (100%) rename src/flint/{nmod_mat.pyx => _nmod_mat.pyx} (99%) rename src/flint/{nmod_poly.pxd => _nmod_poly.pxd} (100%) rename src/flint/{nmod_poly.pyx => _nmod_poly.pyx} (98%) rename src/flint/{nmod_series.pxd => _nmod_series.pxd} (100%) rename src/flint/{nmod_series.pyx => _nmod_series.pyx} (100%) diff --git a/setup.py b/setup.py index 0a7a108e..9db1a1cb 100644 --- a/setup.py +++ b/setup.py @@ -67,20 +67,20 @@ # ("flint._flint", ["src/flint/_flint.pxd"]), # Main Module ("flint.pyflint", ["src/flint/pyflint.pyx"]), # Main Module # Submodules - ("flint.fmpz", ["src/flint/fmpz.pyx"]), - ("flint.fmpz_poly", ["src/flint/fmpz_poly.pyx"]), - ("flint.fmpz_mat", ["src/flint/fmpz_mat.pyx"]), - ("flint.fmpz_series", ["src/flint/fmpz_series.pyx"]), - ("flint.fmpq", ["src/flint/fmpq.pyx"]), - ("flint.fmpq_poly", ["src/flint/fmpq_poly.pyx"]), - ("flint.fmpq_mat", ["src/flint/fmpq_mat.pyx"]), - ("flint.fmpq_series", ["src/flint/fmpq_series.pyx"]), - ("flint.nmod", ["src/flint/nmod.pyx"]), - ("flint.nmod_poly", ["src/flint/nmod_poly.pyx"]), - ("flint.nmod_mat", ["src/flint/nmod_mat.pyx"]), - ("flint.nmod_series", ["src/flint/nmod_series.pyx"]), - ("flint.arf", ["src/flint/arf.pyx"]), - ("flint.arb", ["src/flint/arb.pyx"]), + ("flint._fmpz", ["src/flint/_fmpz.pyx"]), + ("flint._fmpz_poly", ["src/flint/_fmpz_poly.pyx"]), + ("flint._fmpz_mat", ["src/flint/_fmpz_mat.pyx"]), + ("flint._fmpz_series", ["src/flint/_fmpz_series.pyx"]), + ("flint._fmpq", ["src/flint/_fmpq.pyx"]), + ("flint._fmpq_poly", ["src/flint/_fmpq_poly.pyx"]), + ("flint._fmpq_mat", ["src/flint/_fmpq_mat.pyx"]), + ("flint._fmpq_series", ["src/flint/_fmpq_series.pyx"]), + ("flint._nmod", ["src/flint/_nmod.pyx"]), + ("flint._nmod_poly", ["src/flint/_nmod_poly.pyx"]), + ("flint._nmod_mat", ["src/flint/_nmod_mat.pyx"]), + ("flint._nmod_series", ["src/flint/_nmod_series.pyx"]), + ("flint._arf", ["src/flint/_arf.pyx"]), + ("flint._arb", ["src/flint/_arb.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 41214bca..43bdb0ec 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -1,16 +1,16 @@ from .pyflint import * -from .fmpz import * -from .fmpz_poly import * -from .fmpz_mat import * -from .fmpz_series import * -from .fmpq import * -from .fmpq_poly import * -from .fmpq_mat import * -from .fmpq_series import * -from .nmod import * -from .nmod_poly import * -from .nmod_mat import * -from .nmod_series import * -from .arf import * -from .arb import * +from ._fmpz import * +from ._fmpz_poly import * +from ._fmpz_mat import * +from ._fmpz_series import * +from ._fmpq import * +from ._fmpq_poly import * +from ._fmpq_mat import * +from ._fmpq_series import * +from ._nmod import * +from ._nmod_poly import * +from ._nmod_mat import * +from ._nmod_series import * +from ._arf import * +from ._arb import * __version__ = '0.4.2' diff --git a/src/flint/arb.pxd b/src/flint/_arb.pxd similarity index 100% rename from src/flint/arb.pxd rename to src/flint/_arb.pxd diff --git a/src/flint/arb.pyx b/src/flint/_arb.pyx similarity index 94% rename from src/flint/arb.pyx rename to src/flint/_arb.pyx index c0649598..c37443f9 100644 --- a/src/flint/arb.pyx +++ b/src/flint/_arb.pyx @@ -5,10 +5,10 @@ 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, _str_trunc -from flint.fmpz cimport fmpz_set_pylong -from flint.arf cimport arf -from flint.fmpq cimport fmpq -from flint.fmpz cimport fmpz +from flint._fmpz cimport fmpz_set_pylong +from flint._arf cimport arf +from flint._fmpq cimport fmpq +from flint._fmpz cimport fmpz from flint._flint cimport * cimport libc.stdlib @@ -698,6 +698,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) @@ -718,6 +719,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) @@ -740,6 +742,7 @@ cdef class arb(flint_scalar): r""" Exponential function `\exp(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).exp(), dps=25) 2.718281828459045235360287 """ @@ -751,6 +754,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 """ @@ -762,6 +766,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) @@ -782,6 +787,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) @@ -798,6 +805,7 @@ cdef class arb(flint_scalar): r""" Sine function `\sin(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).sin(), dps=25) 0.8414709848078965066525023 """ @@ -809,6 +817,7 @@ cdef class arb(flint_scalar): r""" Cosine function `\cos(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).cos(), dps=25) 0.5403023058681397174009366 """ @@ -820,6 +829,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) """ @@ -832,6 +842,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) @@ -845,6 +856,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) @@ -858,6 +870,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) """ @@ -870,6 +883,7 @@ cdef class arb(flint_scalar): r""" Tangent function `\tan(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).tan(), dps=25) 1.557407724654902230506975 """ @@ -881,6 +895,7 @@ cdef class arb(flint_scalar): r""" Cotangent function `\cot(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).cot(), dps=25) 0.6420926159343307030064200 """ @@ -892,6 +907,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) @@ -905,6 +921,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) @@ -920,6 +937,7 @@ cdef class arb(flint_scalar): 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 """ @@ -933,6 +951,7 @@ cdef class arb(flint_scalar): 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 """ @@ -946,6 +965,7 @@ cdef class arb(flint_scalar): 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) """ @@ -958,6 +978,7 @@ cdef class arb(flint_scalar): """ Secant function `\operatorname{sec}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).sec(), dps=25) 1.850815717680925617911753 """ @@ -969,6 +990,7 @@ cdef class arb(flint_scalar): """ Cosecant function `\operatorname{csc}(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).csc(), dps=25) 1.188395105778121216261599 """ @@ -980,6 +1002,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 """ @@ -991,6 +1014,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) @@ -1004,6 +1028,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 """ @@ -1016,6 +1041,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 """ @@ -1029,6 +1055,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 """ @@ -1040,6 +1067,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 """ @@ -1051,6 +1079,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 """ @@ -1062,6 +1091,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 """ @@ -1073,6 +1103,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 """ @@ -1084,6 +1115,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic sine `\sinh(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).sinh(), dps=25) 1.175201193643801456882382 """ @@ -1095,6 +1127,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic cosine `\cosh(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).cosh(), dps=25) 1.543080634815243778477906 """ @@ -1106,6 +1139,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) """ @@ -1118,6 +1152,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic tangent `\tanh(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).tanh(), dps=25) 0.7615941559557648881194583 """ @@ -1129,6 +1164,7 @@ cdef class arb(flint_scalar): r""" Hyperbolic cotangent `\coth(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).coth(), dps=25) 1.313035285499331303636161 """ @@ -1140,6 +1176,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 """ @@ -1151,6 +1188,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 """ @@ -1162,6 +1200,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) @@ -1185,6 +1224,7 @@ cdef class arb(flint_scalar): improve performance. >>> from flint import fmpq + >>> from flint import showgood >>> showgood(lambda: arb.gamma_fmpq(fmpq(1,4)), dps=25) 3.625609908221908311930685 """ @@ -1197,6 +1237,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()) @@ -1214,6 +1255,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 @@ -1228,6 +1270,7 @@ cdef class arb(flint_scalar): """ Digamma function `\psi(s)`. + >>> from flint import showgood >>> showgood(lambda: arb(1).digamma(), dps=25) -0.5772156649015328606065121 """ @@ -1239,6 +1282,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) @@ -1259,6 +1303,7 @@ cdef class arb(flint_scalar): 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 """ @@ -1288,6 +1333,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) @@ -1309,6 +1355,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) @@ -1336,6 +1383,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) @@ -1355,6 +1403,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) @@ -1372,6 +1421,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) @@ -1388,6 +1438,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 """ @@ -1399,6 +1450,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) @@ -1416,6 +1468,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 """ @@ -1431,6 +1484,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 """ @@ -1458,6 +1512,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 """ @@ -1472,6 +1527,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) @@ -1492,6 +1548,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) @@ -1511,6 +1568,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) @@ -1531,6 +1589,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) """ @@ -1549,6 +1608,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) @@ -1575,6 +1635,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) @@ -1598,6 +1659,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 """ @@ -1610,6 +1672,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 """ @@ -1622,6 +1685,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 """ @@ -1636,6 +1700,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 """ @@ -1649,6 +1714,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 """ @@ -1662,6 +1728,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 """ @@ -1674,6 +1741,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) @@ -1697,6 +1765,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) @@ -1724,6 +1793,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) ... @@ -1758,6 +1828,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 """ @@ -1769,6 +1840,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 """ @@ -1780,6 +1852,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 """ @@ -1791,6 +1864,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) @@ -1804,6 +1878,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) @@ -1817,6 +1892,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 """ @@ -1828,6 +1904,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 """ @@ -1839,6 +1916,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 """ @@ -1850,6 +1928,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 """ @@ -1861,6 +1940,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 """ @@ -1874,6 +1954,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) @@ -1888,6 +1969,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 """ @@ -1901,6 +1983,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 """ @@ -1915,6 +1998,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) @@ -1934,6 +2018,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) @@ -1953,6 +2038,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) @@ -1970,6 +2056,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) @@ -1989,6 +2076,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) @@ -2005,6 +2093,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 """ @@ -2021,6 +2110,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) @@ -2049,6 +2139,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 """ @@ -2064,6 +2155,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) @@ -2081,6 +2173,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) @@ -2097,6 +2190,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) @@ -2107,6 +2201,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) @@ -2134,6 +2229,7 @@ cdef class arb(flint_scalar): """ Returns the constant `\pi` as an *arb*. + >>> from flint import showgood >>> showgood(arb.pi, dps=25) 3.141592653589793238462643 """ @@ -2146,6 +2242,7 @@ cdef class arb(flint_scalar): """ The constant `\sqrt{\pi}`. + >>> from flint import showgood >>> showgood(arb.const_sqrt_pi, dps=25) 1.772453850905516027298167 """ @@ -2158,6 +2255,7 @@ cdef class arb(flint_scalar): """ The constant `\log(2)`. + >>> from flint import showgood >>> showgood(arb.const_log2, dps=25) 0.6931471805599453094172321 """ @@ -2170,6 +2268,7 @@ cdef class arb(flint_scalar): """ The constant `\log(10)`. + >>> from flint import showgood >>> showgood(arb.const_log10, dps=25) 2.302585092994045684017991 """ @@ -2182,6 +2281,7 @@ cdef class arb(flint_scalar): """ Euler's constant `\gamma`. + >>> from flint import showgood >>> showgood(arb.const_euler, dps=25) 0.5772156649015328606065121 """ @@ -2194,6 +2294,7 @@ cdef class arb(flint_scalar): """ Catalan's constant. + >>> from flint import showgood >>> showgood(arb.const_catalan, dps=25) 0.9159655941772190150546035 """ @@ -2206,6 +2307,7 @@ cdef class arb(flint_scalar): """ The constant `e`. + >>> from flint import showgood >>> showgood(arb.const_e, dps=25) 2.718281828459045235360287 """ @@ -2218,6 +2320,7 @@ cdef class arb(flint_scalar): """ Khinchin's constant `K`. + >>> from flint import showgood >>> showgood(arb.const_khinchin, dps=25) 2.685452001065306445309715 """ @@ -2230,6 +2333,7 @@ cdef class arb(flint_scalar): """ Glaisher's constant. + >>> from flint import showgood >>> showgood(arb.const_glaisher, dps=25) 1.282427129100622636875343 """ @@ -2283,6 +2387,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) @@ -2368,6 +2473,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 """ @@ -2380,6 +2486,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) @@ -2419,6 +2526,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 """ @@ -2433,6 +2541,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) """ @@ -2449,6 +2558,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 """ @@ -2464,6 +2574,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 """ diff --git a/src/flint/arf.pxd b/src/flint/_arf.pxd similarity index 100% rename from src/flint/arf.pxd rename to src/flint/_arf.pxd diff --git a/src/flint/arf.pyx b/src/flint/_arf.pyx similarity index 98% rename from src/flint/arf.pyx rename to src/flint/_arf.pyx index 1464ba14..08c19278 100644 --- a/src/flint/arf.pyx +++ b/src/flint/_arf.pyx @@ -2,9 +2,9 @@ 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.fmpz cimport fmpz -from flint.fmpz cimport any_as_fmpz -from flint.arb cimport arb +from flint._fmpz cimport fmpz +from flint._fmpz cimport any_as_fmpz +from flint._arb cimport arb from flint._flint cimport * diff --git a/src/flint/fmpq.pxd b/src/flint/_fmpq.pxd similarity index 100% rename from src/flint/fmpq.pxd rename to src/flint/_fmpq.pxd diff --git a/src/flint/fmpq.pyx b/src/flint/_fmpq.pyx similarity index 99% rename from src/flint/fmpq.pyx rename to src/flint/_fmpq.pyx index 9a5bc60d..e6f814b0 100644 --- a/src/flint/fmpq.pyx +++ b/src/flint/_fmpq.pyx @@ -1,8 +1,8 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck -from flint.fmpz cimport fmpz_set_any_ref -from flint.fmpz cimport fmpz -from flint.fmpz cimport any_as_fmpz +from flint._fmpz cimport fmpz_set_any_ref +from flint._fmpz cimport fmpz +from flint._fmpz cimport any_as_fmpz cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 diff --git a/src/flint/fmpq_mat.pxd b/src/flint/_fmpq_mat.pxd similarity index 80% rename from src/flint/fmpq_mat.pxd rename to src/flint/_fmpq_mat.pxd index 5960ae79..ef32fba6 100644 --- a/src/flint/fmpq_mat.pxd +++ b/src/flint/_fmpq_mat.pxd @@ -1,9 +1,9 @@ from flint.flint_base.flint_base cimport flint_mat from flint._flint cimport fmpq_mat_t -from flint.fmpz cimport fmpz -from flint.fmpq cimport fmpq -from flint.fmpz_mat cimport fmpz_mat +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq +from flint._fmpz_mat cimport fmpz_mat cdef class fmpq_mat(flint_mat): cdef fmpq_mat_t val diff --git a/src/flint/fmpq_mat.pyx b/src/flint/_fmpq_mat.pyx similarity index 98% rename from src/flint/fmpq_mat.pyx rename to src/flint/_fmpq_mat.pyx index 2ae7c2e4..6f2ba265 100644 --- a/src/flint/fmpq_mat.pyx +++ b/src/flint/_fmpq_mat.pyx @@ -1,10 +1,10 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck -from flint.fmpq_poly cimport fmpq_poly -from flint.fmpq cimport any_as_fmpq -from flint.fmpz_poly cimport fmpz_poly -from flint.fmpq_poly cimport fmpq_poly_set_list -from flint.fmpz cimport any_as_fmpz +from flint._fmpq_poly cimport fmpq_poly +from flint._fmpq cimport any_as_fmpq +from flint._fmpz_poly cimport fmpz_poly +from flint._fmpq_poly cimport fmpq_poly_set_list +from flint._fmpz cimport any_as_fmpz from flint._flint cimport * cimport cython diff --git a/src/flint/fmpq_poly.pxd b/src/flint/_fmpq_poly.pxd similarity index 100% rename from src/flint/fmpq_poly.pxd rename to src/flint/_fmpq_poly.pxd diff --git a/src/flint/fmpq_poly.pyx b/src/flint/_fmpq_poly.pyx similarity index 98% rename from src/flint/fmpq_poly.pyx rename to src/flint/_fmpq_poly.pyx index 37efa210..0267337b 100644 --- a/src/flint/fmpq_poly.pyx +++ b/src/flint/_fmpq_poly.pyx @@ -1,11 +1,11 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_poly -from flint.fmpz_poly cimport any_as_fmpz_poly -from flint.fmpz_poly cimport fmpz_poly -from flint.fmpq cimport fmpq -from flint.fmpq cimport any_as_fmpq -from flint.fmpz cimport fmpz -from flint.fmpz cimport any_as_fmpz +from flint._fmpz_poly cimport any_as_fmpz_poly +from flint._fmpz_poly cimport fmpz_poly +from flint._fmpq cimport fmpq +from flint._fmpq cimport any_as_fmpq +from flint._fmpz cimport fmpz +from flint._fmpz cimport any_as_fmpz from flint._flint cimport * @@ -51,6 +51,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 diff --git a/src/flint/fmpq_series.pxd b/src/flint/_fmpq_series.pxd similarity index 100% rename from src/flint/fmpq_series.pxd rename to src/flint/_fmpq_series.pxd diff --git a/src/flint/fmpq_series.pyx b/src/flint/_fmpq_series.pyx similarity index 98% rename from src/flint/fmpq_series.pyx rename to src/flint/_fmpq_series.pyx index 3299aab6..2e380124 100644 --- a/src/flint/fmpq_series.pyx +++ b/src/flint/_fmpq_series.pyx @@ -1,19 +1,19 @@ from flint.flint_base.flint_base cimport flint_series from flint.utils.typecheck cimport typecheck -from flint.fmpz_series cimport fmpz_series -from flint.fmpq_poly cimport fmpq_poly -from flint.fmpq_poly cimport fmpq_poly_set_list -from flint.fmpz cimport fmpz -from flint.fmpz_poly cimport fmpz_poly -from flint.fmpq cimport fmpq -from flint.arb cimport arb +from flint._fmpz_series cimport fmpz_series +from flint._fmpq_poly cimport fmpq_poly +from flint._fmpq_poly cimport fmpq_poly_set_list +from flint._fmpz cimport fmpz +from flint._fmpz_poly cimport fmpz_poly +from flint._fmpq cimport fmpq +from flint._arb cimport arb from flint.pyflint cimport arb_poly from flint.pyflint cimport arb_series from flint.pyflint cimport acb from flint.pyflint cimport acb_poly from flint.pyflint cimport acb_series from flint.flint_base.flint_context cimport getcap -from flint.fmpz cimport any_as_fmpz +from flint._fmpz cimport any_as_fmpz from flint._flint cimport * diff --git a/src/flint/fmpz.pxd b/src/flint/_fmpz.pxd similarity index 100% rename from src/flint/fmpz.pxd rename to src/flint/_fmpz.pxd diff --git a/src/flint/fmpz.pyx b/src/flint/_fmpz.pyx similarity index 99% rename from src/flint/fmpz.pyx rename to src/flint/_fmpz.pyx index c92cd303..ce11e698 100644 --- a/src/flint/fmpz.pyx +++ b/src/flint/_fmpz.pyx @@ -6,7 +6,7 @@ from flint.utils.conversion cimport chars_from_str from flint.utils.conversion cimport str_from_chars, _str_trunc cimport libc.stdlib -from flint.fmpz cimport fmpz +#from flint.fmpz cimport fmpz from flint._flint cimport * cdef FMPZ_UNKNOWN = 0 diff --git a/src/flint/fmpz_mat.pxd b/src/flint/_fmpz_mat.pxd similarity index 89% rename from src/flint/fmpz_mat.pxd rename to src/flint/_fmpz_mat.pxd index 73d5d742..ae9f73c6 100644 --- a/src/flint/fmpz_mat.pxd +++ b/src/flint/_fmpz_mat.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_mat from flint._flint cimport fmpz_mat_t -from flint.fmpz cimport fmpz +from flint._fmpz cimport fmpz cdef any_as_fmpz_mat(obj) cdef class fmpz_mat(flint_mat): diff --git a/src/flint/fmpz_mat.pyx b/src/flint/_fmpz_mat.pyx similarity index 98% rename from src/flint/fmpz_mat.pyx rename to src/flint/_fmpz_mat.pyx index 48828735..a2b6f214 100644 --- a/src/flint/fmpz_mat.pyx +++ b/src/flint/_fmpz_mat.pyx @@ -1,12 +1,12 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck -from flint.fmpz cimport fmpz -from flint.fmpz_poly cimport fmpz_poly -from flint.fmpq_mat cimport fmpq_mat -from flint.fmpz cimport any_as_fmpz -from flint.fmpq cimport fmpq +from flint._fmpz cimport fmpz +from flint._fmpz_poly cimport fmpz_poly +from flint._fmpq_mat cimport fmpq_mat +from flint._fmpz cimport any_as_fmpz +from flint._fmpq cimport fmpq from flint.pyflint cimport global_random_state -from flint.fmpq cimport any_as_fmpq +from flint._fmpq cimport any_as_fmpq cimport cython from flint._flint cimport * @@ -63,6 +63,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]) @@ -551,6 +552,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/fmpz_poly.pxd b/src/flint/_fmpz_poly.pxd similarity index 100% rename from src/flint/fmpz_poly.pxd rename to src/flint/_fmpz_poly.pxd diff --git a/src/flint/fmpz_poly.pyx b/src/flint/_fmpz_poly.pyx similarity index 98% rename from src/flint/fmpz_poly.pyx rename to src/flint/_fmpz_poly.pyx index 98cb7300..06c22df4 100644 --- a/src/flint/fmpz_poly.pyx +++ b/src/flint/_fmpz_poly.pyx @@ -3,16 +3,16 @@ from cpython.version cimport PY_MAJOR_VERSION 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.fmpz cimport fmpz_set_python -from flint.fmpz cimport any_as_fmpz -from flint.fmpz cimport fmpz -from flint.fmpq cimport any_as_fmpq -from flint.fmpq cimport fmpq -from flint.fmpq_poly cimport fmpq_poly -from flint.fmpq_poly cimport any_as_fmpq_poly +from flint._fmpz cimport fmpz_set_python +from flint._fmpz cimport any_as_fmpz +from flint._fmpz cimport fmpz +from flint._fmpq cimport any_as_fmpq +from flint._fmpq cimport fmpq +from flint._fmpq_poly cimport fmpq_poly +from flint._fmpq_poly cimport any_as_fmpq_poly from flint.pyflint cimport acb -from flint.arb cimport any_as_arb_or_notimplemented -from flint.arb cimport arb +from flint._arb cimport any_as_arb_or_notimplemented +from flint._arb cimport arb from flint.pyflint cimport any_as_acb_or_notimplemented cimport libc.stdlib diff --git a/src/flint/fmpz_series.pxd b/src/flint/_fmpz_series.pxd similarity index 100% rename from src/flint/fmpz_series.pxd rename to src/flint/_fmpz_series.pxd diff --git a/src/flint/fmpz_series.pyx b/src/flint/_fmpz_series.pyx similarity index 97% rename from src/flint/fmpz_series.pyx rename to src/flint/_fmpz_series.pyx index 49422d27..da3e3967 100644 --- a/src/flint/fmpz_series.pyx +++ b/src/flint/_fmpz_series.pyx @@ -1,14 +1,14 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_series -from flint.fmpz_poly cimport fmpz_poly_set_list -from flint.fmpz cimport fmpz -from flint.fmpz_poly cimport fmpz_poly +from flint._fmpz_poly cimport fmpz_poly_set_list +from flint._fmpz cimport fmpz +from flint._fmpz_poly cimport fmpz_poly from flint.flint_base.flint_context cimport getcap -from flint.fmpq cimport fmpq -from flint.fmpq_poly cimport fmpq_poly -from flint.fmpq_series cimport fmpq_series -from flint.arb cimport arb +from flint._fmpq cimport fmpq +from flint._fmpq_poly cimport fmpq_poly +from flint._fmpq_series cimport fmpq_series +from flint._arb cimport arb from flint.pyflint cimport arb_poly from flint.pyflint cimport arb_series from flint.pyflint cimport acb diff --git a/src/flint/nmod.pxd b/src/flint/_nmod.pxd similarity index 100% rename from src/flint/nmod.pxd rename to src/flint/_nmod.pxd diff --git a/src/flint/nmod.pyx b/src/flint/_nmod.pyx similarity index 97% rename from src/flint/nmod.pyx rename to src/flint/_nmod.pyx index 1990d0a3..7e2281cc 100644 --- a/src/flint/nmod.pyx +++ b/src/flint/_nmod.pyx @@ -1,9 +1,9 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck -from flint.fmpq cimport any_as_fmpq -from flint.fmpz cimport any_as_fmpz -from flint.fmpz cimport fmpz -from flint.fmpq cimport fmpq +from flint._fmpq cimport any_as_fmpq +from flint._fmpz cimport any_as_fmpz +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq from flint._flint cimport * diff --git a/src/flint/nmod_mat.pxd b/src/flint/_nmod_mat.pxd similarity index 100% rename from src/flint/nmod_mat.pxd rename to src/flint/_nmod_mat.pxd diff --git a/src/flint/nmod_mat.pyx b/src/flint/_nmod_mat.pyx similarity index 99% rename from src/flint/nmod_mat.pyx rename to src/flint/_nmod_mat.pyx index 5d3507c4..5845e507 100644 --- a/src/flint/nmod_mat.pyx +++ b/src/flint/_nmod_mat.pyx @@ -1,9 +1,9 @@ from flint.utils.conversion cimport matrix_to_str from flint.utils.typecheck cimport typecheck -from flint.fmpz_mat cimport any_as_fmpz_mat -from flint.fmpz_mat cimport fmpz_mat -from flint.nmod cimport nmod -from flint.nmod cimport any_as_nmod +from flint._fmpz_mat cimport any_as_fmpz_mat +from flint._fmpz_mat cimport fmpz_mat +from flint._nmod cimport nmod +from flint._nmod cimport any_as_nmod from flint.pyflint cimport global_random_state from flint.flint_base.flint_context cimport thectx diff --git a/src/flint/nmod_poly.pxd b/src/flint/_nmod_poly.pxd similarity index 100% rename from src/flint/nmod_poly.pxd rename to src/flint/_nmod_poly.pxd diff --git a/src/flint/nmod_poly.pyx b/src/flint/_nmod_poly.pyx similarity index 98% rename from src/flint/nmod_poly.pyx rename to src/flint/_nmod_poly.pyx index 51453f3f..745d5068 100644 --- a/src/flint/nmod_poly.pyx +++ b/src/flint/_nmod_poly.pyx @@ -1,9 +1,9 @@ from flint.flint_base.flint_base cimport flint_poly from flint.utils.typecheck cimport typecheck -from flint.fmpz_poly cimport any_as_fmpz_poly -from flint.fmpz_poly cimport fmpz_poly -from flint.nmod cimport any_as_nmod -from flint.nmod cimport nmod +from flint._fmpz_poly cimport any_as_fmpz_poly +from flint._fmpz_poly cimport fmpz_poly +from flint._nmod cimport any_as_nmod +from flint._nmod cimport nmod from flint._flint cimport * @@ -45,6 +45,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 diff --git a/src/flint/nmod_series.pxd b/src/flint/_nmod_series.pxd similarity index 100% rename from src/flint/nmod_series.pxd rename to src/flint/_nmod_series.pxd diff --git a/src/flint/nmod_series.pyx b/src/flint/_nmod_series.pyx similarity index 100% rename from src/flint/nmod_series.pyx rename to src/flint/_nmod_series.pyx diff --git a/src/flint/acb.pyx b/src/flint/acb.pyx index c541a66d..7331f4e8 100644 --- a/src/flint/acb.pyx +++ b/src/flint/acb.pyx @@ -1,7 +1,7 @@ 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.arb cimport arb_set_mpmath_mpf +from flint._arb cimport arb_set_mpmath_mpf cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 diff --git a/src/flint/arb_mat.pyx b/src/flint/arb_mat.pyx index fce67971..0045dce7 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -1,9 +1,9 @@ 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.fmpq_mat cimport fmpq_mat -from flint.fmpz_mat cimport fmpz_mat -from flint.arb cimport arb +from flint._fmpq_mat cimport fmpq_mat +from flint._fmpz_mat cimport fmpz_mat +from flint._arb cimport arb cdef arb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat)): diff --git a/src/flint/arb_poly.pyx b/src/flint/arb_poly.pyx index 014e0480..41b1d56d 100644 --- a/src/flint/arb_poly.pyx +++ b/src/flint/arb_poly.pyx @@ -1,10 +1,10 @@ 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.fmpq_poly cimport fmpq_poly -from flint.fmpz_poly cimport fmpz_poly -from flint.arb cimport arb_set_python -from flint.arb cimport any_as_arb +from flint._fmpq_poly cimport fmpq_poly +from flint._fmpz_poly cimport fmpz_poly +from flint._arb cimport arb_set_python +from flint._arb cimport any_as_arb cdef arb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, fmpz, fmpq, arb, fmpz_poly, fmpq_poly)): diff --git a/src/flint/arb_series.pyx b/src/flint/arb_series.pyx index 1da4ebe5..84f57227 100644 --- a/src/flint/arb_series.pyx +++ b/src/flint/arb_series.pyx @@ -1,8 +1,8 @@ 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.fmpz_series cimport fmpz_series -from flint.fmpq_series cimport fmpq_series +from flint._fmpz_series cimport fmpz_series +from flint._fmpq_series cimport fmpq_series 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)): diff --git a/src/flint/fmpz_mpoly.pyx b/src/flint/fmpz_mpoly.pyx index 382a2a84..862f763d 100644 --- a/src/flint/fmpz_mpoly.pyx +++ b/src/flint/fmpz_mpoly.pyx @@ -3,7 +3,7 @@ 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.fmpz cimport any_as_fmpz +from flint._fmpz cimport any_as_fmpz cdef any_as_fmpz_mpoly(x): cdef fmpz_mpoly res diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 9b0986fd..b1df3796 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -5,7 +5,7 @@ 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.fmpz cimport fmpz +from flint._fmpz cimport fmpz from flint._flint cimport * cdef FMPZ_UNKNOWN = 0 @@ -44,7 +44,7 @@ cdef class Context: # cdef any_as_fmpq(obj) # cdef class fmpq(flint_scalar): # cdef fmpq_t val -from flint.fmpq cimport fmpq +from flint._fmpq cimport fmpq # cdef any_as_fmpq_poly(obj) # cdef class fmpq_poly(flint_poly): diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index d63f7a84..cb3a1dbc 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -51,9 +51,25 @@ def run_tests(verbose=None): def run_doctests(verbose=None): """Run the python-flint doctests""" # Here verbose=True shows a lot of output. -# ffmpz, tfmpz = doctest.testmod(flint.fmpz, verbose=verbose) - failed, total = doctest.testmod(flint.pyflint, verbose=verbose) - return failed, total + modules = [flint.pyflint, + flint._fmpz, + flint._fmpz_poly, + flint._fmpz_mat, + flint._fmpz_series, + flint._fmpq, + flint._fmpq_poly, + flint._fmpq_mat, + flint._fmpq_series, + flint._nmod, + flint._nmod_poly, + flint._nmod_mat, + flint._nmod_series, + flint._arf, + flint._arb] + 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): From 5b8acebefebbe806a99a0db2c64483c5be99f703 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 20:54:59 -0400 Subject: [PATCH 16/39] Modularized arb_poly --- setup.py | 1 + src/flint/_arb_poly.pxd | 9 +++++++++ src/flint/{arb_poly.pyx => _arb_poly.pyx} | 9 +++++++++ src/flint/_fmpq_series.pyx | 2 +- src/flint/_fmpz_series.pyx | 2 +- src/flint/acb.pyx | 1 + src/flint/arb_mat.pyx | 2 ++ src/flint/arb_series.pyx | 3 +++ src/flint/pyflint.pxd | 8 ++++---- src/flint/pyflint.pyx | 2 +- src/flint/test/__main__.py | 3 ++- 11 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 src/flint/_arb_poly.pxd rename src/flint/{arb_poly.pyx => _arb_poly.pyx} (98%) diff --git a/setup.py b/setup.py index 9db1a1cb..8f499668 100644 --- a/setup.py +++ b/setup.py @@ -81,6 +81,7 @@ ("flint._nmod_series", ["src/flint/_nmod_series.pyx"]), ("flint._arf", ["src/flint/_arf.pyx"]), ("flint._arb", ["src/flint/_arb.pyx"]), + ("flint._arb_poly", ["src/flint/_arb_poly.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/_arb_poly.pxd b/src/flint/_arb_poly.pxd new file mode 100644 index 00000000..072b5ac6 --- /dev/null +++ b/src/flint/_arb_poly.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_poly +from flint._flint 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/_arb_poly.pyx similarity index 98% rename from src/flint/arb_poly.pyx rename to src/flint/_arb_poly.pyx index 41b1d56d..44aca30e 100644 --- a/src/flint/arb_poly.pyx +++ b/src/flint/_arb_poly.pyx @@ -5,6 +5,15 @@ from flint._fmpq_poly cimport fmpq_poly from flint._fmpz_poly cimport fmpz_poly from flint._arb cimport arb_set_python from flint._arb cimport any_as_arb +from flint._arb cimport arb +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq +from flint.pyflint cimport acb +from flint.pyflint cimport acb_poly + +from flint._flint 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)): diff --git a/src/flint/_fmpq_series.pyx b/src/flint/_fmpq_series.pyx index 2e380124..b3d1a723 100644 --- a/src/flint/_fmpq_series.pyx +++ b/src/flint/_fmpq_series.pyx @@ -7,7 +7,7 @@ from flint._fmpz cimport fmpz from flint._fmpz_poly cimport fmpz_poly from flint._fmpq cimport fmpq from flint._arb cimport arb -from flint.pyflint cimport arb_poly +from flint._arb_poly cimport arb_poly from flint.pyflint cimport arb_series from flint.pyflint cimport acb from flint.pyflint cimport acb_poly diff --git a/src/flint/_fmpz_series.pyx b/src/flint/_fmpz_series.pyx index da3e3967..fd90e9c3 100644 --- a/src/flint/_fmpz_series.pyx +++ b/src/flint/_fmpz_series.pyx @@ -9,7 +9,7 @@ from flint._fmpq cimport fmpq from flint._fmpq_poly cimport fmpq_poly from flint._fmpq_series cimport fmpq_series from flint._arb cimport arb -from flint.pyflint cimport arb_poly +from flint._arb_poly cimport arb_poly from flint.pyflint cimport arb_series from flint.pyflint cimport acb from flint.pyflint cimport acb_poly diff --git a/src/flint/acb.pyx b/src/flint/acb.pyx index 7331f4e8..248f430d 100644 --- a/src/flint/acb.pyx +++ b/src/flint/acb.pyx @@ -2,6 +2,7 @@ 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._arb cimport arb_set_mpmath_mpf +from flint._arb cimport arb_set_python cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 diff --git a/src/flint/arb_mat.pyx b/src/flint/arb_mat.pyx index 0045dce7..291dc47f 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -4,6 +4,8 @@ from flint.flint_base.flint_base cimport flint_mat from flint._fmpq_mat cimport fmpq_mat from flint._fmpz_mat cimport fmpz_mat from flint._arb cimport arb +from flint._arb_poly cimport arb_poly +from flint._arb cimport any_as_arb cdef arb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat)): diff --git a/src/flint/arb_series.pyx b/src/flint/arb_series.pyx index 84f57227..32939509 100644 --- a/src/flint/arb_series.pyx +++ b/src/flint/arb_series.pyx @@ -2,7 +2,10 @@ 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._fmpz_series cimport fmpz_series +from flint._fmpz_poly cimport fmpz_poly from flint._fmpq_series cimport fmpq_series +from flint._fmpq_poly cimport fmpq_poly +from flint._arb_poly cimport arb_poly_set_list 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)): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index b1df3796..d3b72da7 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -119,10 +119,10 @@ cdef class acb(flint_scalar): cpdef bint is_finite(self) cpdef bint is_exact(self) -cdef class arb_poly(flint_poly): - cdef arb_poly_t val - cpdef long length(self) - cpdef long degree(self) +# cdef class arb_poly(flint_poly): +# cdef arb_poly_t val +# cpdef long length(self) +# cpdef long degree(self) cdef class acb_poly(flint_poly): cdef acb_poly_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 55c5a3e5..ac4edcba 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -48,7 +48,7 @@ include "fmpz_mpoly.pyx" # include "arf.pyx" # include "arb.pyx" -include "arb_poly.pyx" +# include "arb_poly.pyx" include "arb_mat.pyx" include "arb_series.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index cb3a1dbc..03eb9eaf 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -65,7 +65,8 @@ def run_doctests(verbose=None): flint._nmod_mat, flint._nmod_series, flint._arf, - flint._arb] + flint._arb, + flint._arb_poly] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) From 732e230a52c2ad9f58b4d8ee898fd4a598723f33 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 21:38:53 -0400 Subject: [PATCH 17/39] Modularized arb_mat --- setup.py | 1 + src/flint/__init__.py | 2 ++ src/flint/_arb_mat.pxd | 7 +++++++ src/flint/{arb_mat.pyx => _arb_mat.pyx} | 9 +++++++++ src/flint/acb.pyx | 1 + src/flint/acb_mat.pyx | 7 +++++++ src/flint/arb_series.pyx | 2 ++ src/flint/pyflint.pxd | 9 +++++---- src/flint/pyflint.pyx | 2 +- src/flint/test/__main__.py | 3 ++- 10 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 src/flint/_arb_mat.pxd rename src/flint/{arb_mat.pyx => _arb_mat.pyx} (99%) diff --git a/setup.py b/setup.py index 8f499668..78b21027 100644 --- a/setup.py +++ b/setup.py @@ -82,6 +82,7 @@ ("flint._arf", ["src/flint/_arf.pyx"]), ("flint._arb", ["src/flint/_arb.pyx"]), ("flint._arb_poly", ["src/flint/_arb_poly.pyx"]), + ("flint._arb_mat", ["src/flint/_arb_mat.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 43bdb0ec..bdaa1652 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -13,4 +13,6 @@ from ._nmod_series import * from ._arf import * from ._arb import * +from ._arb_poly import * +from ._arb_mat import * __version__ = '0.4.2' diff --git a/src/flint/_arb_mat.pxd b/src/flint/_arb_mat.pxd new file mode 100644 index 00000000..6446a85f --- /dev/null +++ b/src/flint/_arb_mat.pxd @@ -0,0 +1,7 @@ +from flint.flint_base.flint_base cimport flint_mat +from flint._flint 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/_arb_mat.pyx similarity index 99% rename from src/flint/arb_mat.pyx rename to src/flint/_arb_mat.pyx index 291dc47f..cea77b09 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/_arb_mat.pyx @@ -6,6 +6,14 @@ from flint._fmpz_mat cimport fmpz_mat from flint._arb cimport arb from flint._arb_poly cimport arb_poly from flint._arb cimport any_as_arb +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq +from flint.pyflint cimport acb +from flint.pyflint cimport acb_mat +from flint.pyflint cimport any_as_acb + +from flint._flint cimport * +cimport cython cdef arb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat)): @@ -183,6 +191,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 diff --git a/src/flint/acb.pyx b/src/flint/acb.pyx index 248f430d..cc94424a 100644 --- a/src/flint/acb.pyx +++ b/src/flint/acb.pyx @@ -3,6 +3,7 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.flint_base.flint_context cimport getprec from flint._arb cimport arb_set_mpmath_mpf from flint._arb cimport arb_set_python +from flint._arb cimport any_as_arb cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 diff --git a/src/flint/acb_mat.pyx b/src/flint/acb_mat.pyx index 99b882cd..e72bc350 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/acb_mat.pyx @@ -1,6 +1,9 @@ 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._arb_mat cimport arb_mat +from flint._fmpz_mat cimport fmpz_mat +from flint._fmpq_mat cimport fmpq_mat cdef acb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat, arb_mat)): @@ -190,6 +193,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 @@ -520,6 +524,7 @@ cdef class acb_mat(flint_mat): >>> 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 @@ -671,6 +676,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/arb_series.pyx b/src/flint/arb_series.pyx index 32939509..0f9c16b6 100644 --- a/src/flint/arb_series.pyx +++ b/src/flint/arb_series.pyx @@ -6,6 +6,8 @@ from flint._fmpz_poly cimport fmpz_poly from flint._fmpq_series cimport fmpq_series from flint._fmpq_poly cimport fmpq_poly from flint._arb_poly cimport arb_poly_set_list +from flint._arb cimport arb +from flint._arb_poly cimport arb_poly 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)): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index d3b72da7..4435ba3e 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -112,6 +112,7 @@ from flint._fmpq cimport fmpq # cpdef bint is_integer(self) +cdef any_as_acb(x) cdef any_as_acb_or_notimplemented(x) cdef class acb(flint_scalar): cdef acb_t val @@ -130,10 +131,10 @@ cdef class acb_poly(flint_poly): cpdef long degree(self) -cdef class arb_mat(flint_mat): - cdef arb_mat_t val - cpdef long nrows(self) - cpdef long ncols(self) +# cdef class arb_mat(flint_mat): +# cdef arb_mat_t val +# cpdef long nrows(self) +# cpdef long ncols(self) cdef class acb_mat(flint_mat): cdef acb_mat_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index ac4edcba..1bc23825 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -49,7 +49,7 @@ include "fmpz_mpoly.pyx" # include "arf.pyx" # include "arb.pyx" # include "arb_poly.pyx" -include "arb_mat.pyx" +#include "arb_mat.pyx" include "arb_series.pyx" include "acb.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index 03eb9eaf..a87b6b6b 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -66,7 +66,8 @@ def run_doctests(verbose=None): flint._nmod_series, flint._arf, flint._arb, - flint._arb_poly] + flint._arb_poly, + flint._arb_mat] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) From e1a3384bfed19e612713004ad59c7824d3ccc296 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 22:23:13 -0400 Subject: [PATCH 18/39] modularize arb_series getting close --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/_arb_series.pxd | 9 +++++++++ src/flint/{arb_series.pyx => _arb_series.pyx} | 10 ++++++++++ src/flint/_fmpq_series.pyx | 2 +- src/flint/_fmpz_series.pyx | 2 +- src/flint/acb.pyx | 1 + src/flint/acb_poly.pyx | 3 +++ src/flint/acb_series.pyx | 3 +++ src/flint/pyflint.pxd | 10 +++++----- src/flint/pyflint.pyx | 4 ++-- src/flint/test/__main__.py | 3 ++- 12 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 src/flint/_arb_series.pxd rename src/flint/{arb_series.pyx => _arb_series.pyx} (99%) diff --git a/setup.py b/setup.py index 78b21027..0cad4fc1 100644 --- a/setup.py +++ b/setup.py @@ -83,6 +83,7 @@ ("flint._arb", ["src/flint/_arb.pyx"]), ("flint._arb_poly", ["src/flint/_arb_poly.pyx"]), ("flint._arb_mat", ["src/flint/_arb_mat.pyx"]), + ("flint._arb_series", ["src/flint/_arb_series.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 bdaa1652..301f1c8d 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -15,4 +15,5 @@ from ._arb import * from ._arb_poly import * from ._arb_mat import * +from ._arb_series import * __version__ = '0.4.2' diff --git a/src/flint/_arb_series.pxd b/src/flint/_arb_series.pxd new file mode 100644 index 00000000..2506550d --- /dev/null +++ b/src/flint/_arb_series.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_series + +from flint._flint 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/_arb_series.pyx similarity index 99% rename from src/flint/arb_series.pyx rename to src/flint/_arb_series.pyx index 0f9c16b6..865d3147 100644 --- a/src/flint/arb_series.pyx +++ b/src/flint/_arb_series.pyx @@ -1,5 +1,6 @@ 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._fmpz_series cimport fmpz_series from flint._fmpz_poly cimport fmpz_poly @@ -8,6 +9,15 @@ from flint._fmpq_poly cimport fmpq_poly from flint._arb_poly cimport arb_poly_set_list from flint._arb cimport arb from flint._arb_poly cimport arb_poly +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq +from flint.pyflint cimport acb +from flint.pyflint cimport acb_poly +from flint.pyflint cimport acb_series + +from flint._flint 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)): diff --git a/src/flint/_fmpq_series.pyx b/src/flint/_fmpq_series.pyx index b3d1a723..906139bf 100644 --- a/src/flint/_fmpq_series.pyx +++ b/src/flint/_fmpq_series.pyx @@ -8,7 +8,7 @@ from flint._fmpz_poly cimport fmpz_poly from flint._fmpq cimport fmpq from flint._arb cimport arb from flint._arb_poly cimport arb_poly -from flint.pyflint cimport arb_series +from flint._arb_series cimport arb_series from flint.pyflint cimport acb from flint.pyflint cimport acb_poly from flint.pyflint cimport acb_series diff --git a/src/flint/_fmpz_series.pyx b/src/flint/_fmpz_series.pyx index fd90e9c3..c96d4393 100644 --- a/src/flint/_fmpz_series.pyx +++ b/src/flint/_fmpz_series.pyx @@ -10,7 +10,7 @@ from flint._fmpq_poly cimport fmpq_poly from flint._fmpq_series cimport fmpq_series from flint._arb cimport arb from flint._arb_poly cimport arb_poly -from flint.pyflint cimport arb_series +from flint._arb_series cimport arb_series from flint.pyflint cimport acb from flint.pyflint cimport acb_poly from flint.pyflint cimport acb_series diff --git a/src/flint/acb.pyx b/src/flint/acb.pyx index cc94424a..1442b5cf 100644 --- a/src/flint/acb.pyx +++ b/src/flint/acb.pyx @@ -4,6 +4,7 @@ from flint.flint_base.flint_context cimport getprec from flint._arb cimport arb_set_mpmath_mpf from flint._arb cimport arb_set_python from flint._arb cimport any_as_arb +from flint._arb cimport arb cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 diff --git a/src/flint/acb_poly.pyx b/src/flint/acb_poly.pyx index 5b8908fb..2605f973 100644 --- a/src/flint/acb_poly.pyx +++ b/src/flint/acb_poly.pyx @@ -1,6 +1,9 @@ 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._fmpz_poly cimport fmpz_poly +from flint._fmpq_poly cimport fmpq_poly +from flint._arb_poly cimport arb_poly cdef acb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, complex, fmpz, fmpq, arb, acb, fmpz_poly, fmpq_poly, arb_poly)): diff --git a/src/flint/acb_series.pyx b/src/flint/acb_series.pyx index 82705a1b..5af6ac8e 100644 --- a/src/flint/acb_series.pyx +++ b/src/flint/acb_series.pyx @@ -1,6 +1,9 @@ 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._fmpz_series cimport fmpz_series +from flint._fmpq_series cimport fmpq_series +from flint._arb_series cimport arb_series 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)): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 4435ba3e..2c999109 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -141,11 +141,11 @@ cdef class acb_mat(flint_mat): cpdef long nrows(self) cpdef long ncols(self) -cdef class arb_series(flint_series): - cdef arb_poly_t val - cdef long prec - cpdef long length(self) - cpdef valuation(self) +# cdef class arb_series(flint_series): +# cdef arb_poly_t val +# cdef long prec +# cpdef long length(self) +# cpdef valuation(self) cdef class acb_series(flint_series): cdef acb_poly_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 1bc23825..032ad190 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -49,8 +49,8 @@ include "fmpz_mpoly.pyx" # include "arf.pyx" # include "arb.pyx" # include "arb_poly.pyx" -#include "arb_mat.pyx" -include "arb_series.pyx" +# include "arb_mat.pyx" +# include "arb_series.pyx" include "acb.pyx" include "acb_poly.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index a87b6b6b..6c95550b 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -67,7 +67,8 @@ def run_doctests(verbose=None): flint._arf, flint._arb, flint._arb_poly, - flint._arb_mat] + flint._arb_mat, + flint._arb_series] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) From 61c179debefb195de3c54b832c452dda4d61d618 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sat, 2 Sep 2023 23:26:58 -0400 Subject: [PATCH 19/39] Modularized acb This took a lot of adding showgood into to doctests. Not sure how to do it better. --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/_acb.pxd | 11 +++ src/flint/{acb.pyx => _acb.pyx} | 147 +++++++++++++++++++++++++++++++- src/flint/_arb_mat.pyx | 4 +- src/flint/_arb_poly.pyx | 2 +- src/flint/_arb_series.pyx | 2 +- src/flint/_fmpq_series.pyx | 2 +- src/flint/_fmpz_poly.pyx | 4 +- src/flint/_fmpz_series.pyx | 2 +- src/flint/acb_mat.pyx | 2 + src/flint/acb_poly.pyx | 2 + src/flint/dirichlet.pyx | 8 +- src/flint/functions.pyx | 1 + src/flint/pyflint.pxd | 24 ++++-- src/flint/pyflint.pyx | 2 +- src/flint/test/__main__.py | 3 +- 17 files changed, 194 insertions(+), 24 deletions(-) create mode 100644 src/flint/_acb.pxd rename src/flint/{acb.pyx => _acb.pyx} (93%) diff --git a/setup.py b/setup.py index 0cad4fc1..d011b0e4 100644 --- a/setup.py +++ b/setup.py @@ -84,6 +84,7 @@ ("flint._arb_poly", ["src/flint/_arb_poly.pyx"]), ("flint._arb_mat", ["src/flint/_arb_mat.pyx"]), ("flint._arb_series", ["src/flint/_arb_series.pyx"]), + ("flint._acb", ["src/flint/_acb.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 301f1c8d..9441d5ab 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -16,4 +16,5 @@ from ._arb_poly import * from ._arb_mat import * from ._arb_series import * +from ._acb import * __version__ = '0.4.2' diff --git a/src/flint/_acb.pxd b/src/flint/_acb.pxd new file mode 100644 index 00000000..e8ba4faf --- /dev/null +++ b/src/flint/_acb.pxd @@ -0,0 +1,11 @@ +from flint.flint_base.flint_base cimport flint_scalar +from flint._flint 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/_acb.pyx similarity index 93% rename from src/flint/acb.pyx rename to src/flint/_acb.pyx index 1442b5cf..b0aeda29 100644 --- a/src/flint/acb.pyx +++ b/src/flint/_acb.pyx @@ -1,15 +1,28 @@ +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._arb cimport arb_set_mpmath_mpf from flint._arb cimport arb_set_python from flint._arb cimport any_as_arb from flint._arb cimport arb +from flint._fmpz cimport fmpz +from flint._fmpz cimport any_as_fmpz +from flint.pyflint cimport dirichlet_char + +from flint._flint cimport * +cimport libc.stdlib +cimport cython cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 cdef FMPZ_TMP = 2 +ctx = thectx + cdef int acb_set_python(acb_t x, obj, bint allow_conversion): cdef double re, im @@ -21,9 +34,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))) @@ -331,6 +344,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) @@ -344,6 +358,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) @@ -359,6 +374,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) @@ -512,6 +528,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) @@ -525,6 +542,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) @@ -538,6 +556,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 """ @@ -549,6 +568,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 """ @@ -560,6 +580,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 """ @@ -571,6 +592,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 """ @@ -582,6 +604,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 """ @@ -593,6 +616,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 """ @@ -605,6 +629,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) @@ -626,6 +651,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 """ @@ -638,6 +664,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()) @@ -656,6 +683,7 @@ cdef class acb(flint_scalar): 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) @@ -669,6 +697,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 """ @@ -681,6 +710,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) @@ -711,6 +741,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 """ @@ -722,12 +753,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) @@ -744,6 +777,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 """ @@ -755,6 +789,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 """ @@ -766,6 +801,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) @@ -781,6 +817,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 """ @@ -792,6 +829,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 """ @@ -803,6 +841,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 """ @@ -814,6 +853,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) """ @@ -826,6 +866,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 """ @@ -837,6 +878,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 """ @@ -848,6 +890,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 """ @@ -859,6 +902,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 """ @@ -870,6 +914,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) """ @@ -882,6 +927,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 """ @@ -893,6 +939,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 """ @@ -904,6 +951,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 """ @@ -915,6 +963,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 """ @@ -926,6 +975,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 """ @@ -937,6 +987,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 """ @@ -948,6 +999,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) """ @@ -960,6 +1012,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 """ @@ -971,6 +1024,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 """ @@ -982,6 +1036,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 """ @@ -993,6 +1048,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 """ @@ -1004,6 +1060,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 """ @@ -1015,6 +1072,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 """ @@ -1026,6 +1084,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) @@ -1043,6 +1102,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) """ @@ -1057,6 +1117,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) @@ -1071,6 +1132,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) @@ -1089,6 +1151,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) ... @@ -1134,6 +1197,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 """ @@ -1145,6 +1209,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) @@ -1158,6 +1223,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 """ @@ -1169,6 +1235,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 """ @@ -1180,6 +1247,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) @@ -1194,6 +1262,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) @@ -1233,6 +1302,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) @@ -1250,6 +1320,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) @@ -1269,6 +1340,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) @@ -1285,6 +1357,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 """ @@ -1297,6 +1370,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 """ @@ -1308,6 +1382,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 """ @@ -1322,6 +1397,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 """ @@ -1333,6 +1409,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 """ @@ -1344,6 +1421,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 """ @@ -1355,6 +1433,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 """ @@ -1366,6 +1445,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 """ @@ -1379,6 +1459,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) @@ -1394,6 +1475,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) @@ -1405,6 +1487,7 @@ cdef class acb(flint_scalar): 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) @@ -1431,6 +1514,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 """ @@ -1443,6 +1527,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 """ @@ -1455,6 +1540,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 """ @@ -1469,6 +1555,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 """ @@ -1482,6 +1569,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 """ @@ -1495,6 +1583,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 """ @@ -1507,6 +1596,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) @@ -1532,6 +1622,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) @@ -1559,6 +1650,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 """ @@ -1573,6 +1665,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) @@ -1592,6 +1685,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) @@ -1612,6 +1706,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) """ @@ -1627,6 +1722,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) @@ -1684,6 +1780,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 """ @@ -1730,6 +1827,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 """ @@ -1742,6 +1840,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 """ @@ -1755,6 +1854,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 """ @@ -1768,6 +1868,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 """ @@ -1795,6 +1896,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) @@ -1815,6 +1917,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 """ @@ -1870,6 +1973,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) @@ -1883,6 +1987,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) @@ -1897,6 +2002,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) @@ -1911,6 +2017,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 """ @@ -1926,6 +2033,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 """ @@ -1940,6 +2048,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 """ @@ -1956,6 +2065,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 """ @@ -1971,6 +2081,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 """ @@ -1986,6 +2097,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) @@ -2002,6 +2114,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) @@ -2018,6 +2131,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 """ @@ -2032,6 +2146,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) @@ -2048,6 +2163,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) @@ -2062,6 +2178,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 """ @@ -2074,6 +2191,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 """ @@ -2087,6 +2205,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 """ @@ -2100,6 +2219,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) """ @@ -2114,6 +2234,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) """ @@ -2126,6 +2247,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) @@ -2141,6 +2263,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 """ @@ -2154,6 +2277,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) @@ -2169,6 +2293,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 """ @@ -2182,6 +2307,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) @@ -2201,6 +2327,7 @@ cdef class acb(flint_scalar): 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) @@ -2246,6 +2373,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) @@ -2275,6 +2403,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) @@ -2302,6 +2431,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) @@ -2317,6 +2447,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 """ @@ -2331,6 +2462,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) @@ -2352,6 +2484,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) @@ -2369,6 +2502,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) @@ -2383,6 +2517,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) @@ -2445,6 +2580,7 @@ cdef class acb(flint_scalar): *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) @@ -2467,6 +2603,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 @@ -2475,6 +2612,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 @@ -2554,6 +2692,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) """ @@ -2572,6 +2711,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 """ @@ -2587,6 +2727,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/_arb_mat.pyx b/src/flint/_arb_mat.pyx index cea77b09..607a4c2e 100644 --- a/src/flint/_arb_mat.pyx +++ b/src/flint/_arb_mat.pyx @@ -8,9 +8,9 @@ from flint._arb_poly cimport arb_poly from flint._arb cimport any_as_arb from flint._fmpz cimport fmpz from flint._fmpq cimport fmpq -from flint.pyflint cimport acb +from flint._acb cimport acb from flint.pyflint cimport acb_mat -from flint.pyflint cimport any_as_acb +from flint._acb cimport any_as_acb from flint._flint cimport * cimport cython diff --git a/src/flint/_arb_poly.pyx b/src/flint/_arb_poly.pyx index 44aca30e..b827cef4 100644 --- a/src/flint/_arb_poly.pyx +++ b/src/flint/_arb_poly.pyx @@ -8,7 +8,7 @@ from flint._arb cimport any_as_arb from flint._arb cimport arb from flint._fmpz cimport fmpz from flint._fmpq cimport fmpq -from flint.pyflint cimport acb +from flint._acb cimport acb from flint.pyflint cimport acb_poly from flint._flint cimport * diff --git a/src/flint/_arb_series.pyx b/src/flint/_arb_series.pyx index 865d3147..a3d42ff0 100644 --- a/src/flint/_arb_series.pyx +++ b/src/flint/_arb_series.pyx @@ -11,7 +11,7 @@ from flint._arb cimport arb from flint._arb_poly cimport arb_poly from flint._fmpz cimport fmpz from flint._fmpq cimport fmpq -from flint.pyflint cimport acb +from flint._acb cimport acb from flint.pyflint cimport acb_poly from flint.pyflint cimport acb_series diff --git a/src/flint/_fmpq_series.pyx b/src/flint/_fmpq_series.pyx index 906139bf..06054acb 100644 --- a/src/flint/_fmpq_series.pyx +++ b/src/flint/_fmpq_series.pyx @@ -9,7 +9,7 @@ from flint._fmpq cimport fmpq from flint._arb cimport arb from flint._arb_poly cimport arb_poly from flint._arb_series cimport arb_series -from flint.pyflint cimport acb +from flint._acb cimport acb from flint.pyflint cimport acb_poly from flint.pyflint cimport acb_series from flint.flint_base.flint_context cimport getcap diff --git a/src/flint/_fmpz_poly.pyx b/src/flint/_fmpz_poly.pyx index 06c22df4..1fd0dc43 100644 --- a/src/flint/_fmpz_poly.pyx +++ b/src/flint/_fmpz_poly.pyx @@ -10,10 +10,10 @@ from flint._fmpq cimport any_as_fmpq from flint._fmpq cimport fmpq from flint._fmpq_poly cimport fmpq_poly from flint._fmpq_poly cimport any_as_fmpq_poly -from flint.pyflint cimport acb +from flint._acb cimport acb from flint._arb cimport any_as_arb_or_notimplemented from flint._arb cimport arb -from flint.pyflint cimport any_as_acb_or_notimplemented +from flint._acb cimport any_as_acb_or_notimplemented cimport libc.stdlib from flint._flint cimport * diff --git a/src/flint/_fmpz_series.pyx b/src/flint/_fmpz_series.pyx index c96d4393..495592c0 100644 --- a/src/flint/_fmpz_series.pyx +++ b/src/flint/_fmpz_series.pyx @@ -11,7 +11,7 @@ from flint._fmpq_series cimport fmpq_series from flint._arb cimport arb from flint._arb_poly cimport arb_poly from flint._arb_series cimport arb_series -from flint.pyflint cimport acb +from flint._acb cimport acb from flint.pyflint cimport acb_poly from flint.pyflint cimport acb_series diff --git a/src/flint/acb_mat.pyx b/src/flint/acb_mat.pyx index e72bc350..5e6548a2 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/acb_mat.pyx @@ -4,6 +4,8 @@ from flint.flint_base.flint_base cimport flint_mat from flint._arb_mat cimport arb_mat from flint._fmpz_mat cimport fmpz_mat from flint._fmpq_mat cimport fmpq_mat +from flint._arb cimport arb +from flint._acb cimport acb cdef acb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat, arb_mat)): diff --git a/src/flint/acb_poly.pyx b/src/flint/acb_poly.pyx index 2605f973..c80ac02b 100644 --- a/src/flint/acb_poly.pyx +++ b/src/flint/acb_poly.pyx @@ -4,6 +4,8 @@ from flint.flint_base.flint_base cimport flint_poly from flint._fmpz_poly cimport fmpz_poly from flint._fmpq_poly cimport fmpq_poly from flint._arb_poly cimport arb_poly +from flint._acb cimport acb_set_python +from flint._acb cimport any_as_acb cdef acb_poly_coerce_operands(x, y): if isinstance(y, (int, long, float, complex, fmpz, fmpq, arb, acb, fmpz_poly, fmpq_poly, arb_poly)): diff --git a/src/flint/dirichlet.pyx b/src/flint/dirichlet.pyx index 8ec160ec..7a5fa2e5 100644 --- a/src/flint/dirichlet.pyx +++ b/src/flint/dirichlet.pyx @@ -11,8 +11,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 +74,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 diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 582db087..9226edf5 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -47,6 +47,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): ... diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 2c999109..f731727e 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -112,13 +112,13 @@ from flint._fmpq cimport fmpq # cpdef bint is_integer(self) -cdef any_as_acb(x) -cdef any_as_acb_or_notimplemented(x) -cdef class acb(flint_scalar): - cdef acb_t val - cpdef bint is_zero(self) - cpdef bint is_finite(self) - cpdef bint is_exact(self) +# cdef any_as_acb(x) +# cdef any_as_acb_or_notimplemented(x) +# cdef class acb(flint_scalar): +# cdef acb_t val +# cpdef bint is_zero(self) +# cpdef bint is_finite(self) +# cpdef bint is_exact(self) # cdef class arb_poly(flint_poly): # cdef arb_poly_t val @@ -164,3 +164,13 @@ cdef class fmpz_mpoly(flint_mpoly): cdef fmpz_mpoly_ctx ctx cdef bint _init +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/pyflint.pyx b/src/flint/pyflint.pyx index 032ad190..58164ca2 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -52,7 +52,7 @@ include "fmpz_mpoly.pyx" # include "arb_mat.pyx" # include "arb_series.pyx" -include "acb.pyx" +# include "acb.pyx" include "acb_poly.pyx" include "acb_mat.pyx" include "acb_series.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index 6c95550b..eb7b171a 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -68,7 +68,8 @@ def run_doctests(verbose=None): flint._arb, flint._arb_poly, flint._arb_mat, - flint._arb_series] + flint._arb_series, + flint._acb] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) From 80cf71687d8743d2f4963e311a170b112c6074de Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sun, 3 Sep 2023 09:30:09 -0400 Subject: [PATCH 20/39] Modularized arb_poly. --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/_acb_poly.pxd | 9 +++++++++ src/flint/{acb_poly.pyx => _acb_poly.pyx} | 7 +++++++ src/flint/_arb_poly.pyx | 2 +- src/flint/_arb_series.pyx | 2 +- src/flint/_fmpq_series.pyx | 2 +- src/flint/_fmpz_series.pyx | 2 +- src/flint/acb_mat.pyx | 2 ++ src/flint/acb_series.pyx | 6 ++++++ src/flint/pyflint.pxd | 8 ++++---- src/flint/pyflint.pyx | 2 +- src/flint/test/__main__.py | 3 ++- 13 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 src/flint/_acb_poly.pxd rename src/flint/{acb_poly.pyx => _acb_poly.pyx} (98%) diff --git a/setup.py b/setup.py index d011b0e4..b7460f1f 100644 --- a/setup.py +++ b/setup.py @@ -85,6 +85,7 @@ ("flint._arb_mat", ["src/flint/_arb_mat.pyx"]), ("flint._arb_series", ["src/flint/_arb_series.pyx"]), ("flint._acb", ["src/flint/_acb.pyx"]), + ("flint._acb_poly", ["src/flint/_acb_poly.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 9441d5ab..4c8c1a94 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -17,4 +17,5 @@ from ._arb_mat import * from ._arb_series import * from ._acb import * +from ._acb_poly import * __version__ = '0.4.2' diff --git a/src/flint/_acb_poly.pxd b/src/flint/_acb_poly.pxd new file mode 100644 index 00000000..f6aca1ad --- /dev/null +++ b/src/flint/_acb_poly.pxd @@ -0,0 +1,9 @@ +from flint.flint_base.flint_base cimport flint_poly + +from flint._flint 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/_acb_poly.pyx similarity index 98% rename from src/flint/acb_poly.pyx rename to src/flint/_acb_poly.pyx index c80ac02b..cdbeb0ab 100644 --- a/src/flint/acb_poly.pyx +++ b/src/flint/_acb_poly.pyx @@ -6,6 +6,13 @@ from flint._fmpq_poly cimport fmpq_poly from flint._arb_poly cimport arb_poly from flint._acb cimport acb_set_python from flint._acb cimport any_as_acb +from flint._acb cimport acb +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq +from flint._arb cimport arb + +from flint._flint 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)): diff --git a/src/flint/_arb_poly.pyx b/src/flint/_arb_poly.pyx index b827cef4..25465ea7 100644 --- a/src/flint/_arb_poly.pyx +++ b/src/flint/_arb_poly.pyx @@ -9,7 +9,7 @@ from flint._arb cimport arb from flint._fmpz cimport fmpz from flint._fmpq cimport fmpq from flint._acb cimport acb -from flint.pyflint cimport acb_poly +from flint._acb_poly cimport acb_poly from flint._flint cimport * cimport cython diff --git a/src/flint/_arb_series.pyx b/src/flint/_arb_series.pyx index a3d42ff0..3cefa677 100644 --- a/src/flint/_arb_series.pyx +++ b/src/flint/_arb_series.pyx @@ -12,7 +12,7 @@ from flint._arb_poly cimport arb_poly from flint._fmpz cimport fmpz from flint._fmpq cimport fmpq from flint._acb cimport acb -from flint.pyflint cimport acb_poly +from flint._acb_poly cimport acb_poly from flint.pyflint cimport acb_series from flint._flint cimport * diff --git a/src/flint/_fmpq_series.pyx b/src/flint/_fmpq_series.pyx index 06054acb..505b9a93 100644 --- a/src/flint/_fmpq_series.pyx +++ b/src/flint/_fmpq_series.pyx @@ -10,7 +10,7 @@ from flint._arb cimport arb from flint._arb_poly cimport arb_poly from flint._arb_series cimport arb_series from flint._acb cimport acb -from flint.pyflint cimport acb_poly +from flint._acb_poly cimport acb_poly from flint.pyflint cimport acb_series from flint.flint_base.flint_context cimport getcap from flint._fmpz cimport any_as_fmpz diff --git a/src/flint/_fmpz_series.pyx b/src/flint/_fmpz_series.pyx index 495592c0..c60b18c3 100644 --- a/src/flint/_fmpz_series.pyx +++ b/src/flint/_fmpz_series.pyx @@ -12,7 +12,7 @@ from flint._arb cimport arb from flint._arb_poly cimport arb_poly from flint._arb_series cimport arb_series from flint._acb cimport acb -from flint.pyflint cimport acb_poly +from flint._acb_poly cimport acb_poly from flint.pyflint cimport acb_series from flint._flint cimport * diff --git a/src/flint/acb_mat.pyx b/src/flint/acb_mat.pyx index 5e6548a2..a676eb9c 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/acb_mat.pyx @@ -6,6 +6,8 @@ from flint._fmpz_mat cimport fmpz_mat from flint._fmpq_mat cimport fmpq_mat from flint._arb cimport arb from flint._acb cimport acb +from flint._acb_poly cimport acb_poly +from flint._acb cimport any_as_acb cdef acb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat, arb_mat)): diff --git a/src/flint/acb_series.pyx b/src/flint/acb_series.pyx index 5af6ac8e..0651d503 100644 --- a/src/flint/acb_series.pyx +++ b/src/flint/acb_series.pyx @@ -4,6 +4,12 @@ from flint.flint_base.flint_base cimport flint_series from flint._fmpz_series cimport fmpz_series from flint._fmpq_series cimport fmpq_series from flint._arb_series cimport arb_series +from flint._acb cimport acb +from flint._fmpz_poly cimport fmpz_poly +from flint._fmpq_poly cimport fmpq_poly +from flint._arb_poly cimport arb_poly +from flint._arb_poly cimport arb_poly_set_list +from flint._acb_poly cimport acb_poly_set_list 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)): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index f731727e..3af97620 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -125,10 +125,10 @@ from flint._fmpq cimport fmpq # cpdef long length(self) # cpdef long degree(self) -cdef class acb_poly(flint_poly): - cdef acb_poly_t val - cpdef long length(self) - cpdef long degree(self) +# cdef class acb_poly(flint_poly): +# cdef acb_poly_t val +# cpdef long length(self) +# cpdef long degree(self) # cdef class arb_mat(flint_mat): diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index 58164ca2..fd071aec 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -53,7 +53,7 @@ include "fmpz_mpoly.pyx" # include "arb_series.pyx" # include "acb.pyx" -include "acb_poly.pyx" +# include "acb_poly.pyx" include "acb_mat.pyx" include "acb_series.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index eb7b171a..65c951cf 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -69,7 +69,8 @@ def run_doctests(verbose=None): flint._arb_poly, flint._arb_mat, flint._arb_series, - flint._acb] + flint._acb, + flint._acb_poly] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) From 6234658a0983778892f16837a5b69145945bdddc Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sun, 3 Sep 2023 10:06:14 -0400 Subject: [PATCH 21/39] Modularized acb_mat --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/_acb_mat.pxd | 8 ++++++++ src/flint/{acb_mat.pyx => _acb_mat.pyx} | 5 +++++ src/flint/_arb_mat.pyx | 2 +- src/flint/acb_series.pyx | 2 ++ src/flint/dirichlet.pyx | 1 + src/flint/functions.pyx | 4 ++++ src/flint/pyflint.pxd | 8 ++++---- src/flint/pyflint.pyx | 2 +- src/flint/test/__main__.py | 3 ++- 11 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 src/flint/_acb_mat.pxd rename src/flint/{acb_mat.pyx => _acb_mat.pyx} (99%) diff --git a/setup.py b/setup.py index b7460f1f..5623c614 100644 --- a/setup.py +++ b/setup.py @@ -86,6 +86,7 @@ ("flint._arb_series", ["src/flint/_arb_series.pyx"]), ("flint._acb", ["src/flint/_acb.pyx"]), ("flint._acb_poly", ["src/flint/_acb_poly.pyx"]), + ("flint._acb_mat", ["src/flint/_acb_mat.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 4c8c1a94..e6cd6b81 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -18,4 +18,5 @@ from ._arb_series import * from ._acb import * from ._acb_poly import * +from ._acb_mat import * __version__ = '0.4.2' diff --git a/src/flint/_acb_mat.pxd b/src/flint/_acb_mat.pxd new file mode 100644 index 00000000..bfeecc43 --- /dev/null +++ b/src/flint/_acb_mat.pxd @@ -0,0 +1,8 @@ +from flint.flint_base.flint_base cimport flint_mat + +from flint._flint 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/_acb_mat.pyx similarity index 99% rename from src/flint/acb_mat.pyx rename to src/flint/_acb_mat.pyx index a676eb9c..2e2ee75f 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/_acb_mat.pyx @@ -8,6 +8,11 @@ from flint._arb cimport arb from flint._acb cimport acb from flint._acb_poly cimport acb_poly from flint._acb cimport any_as_acb +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq + +from flint._flint cimport * +cimport cython cdef acb_mat_coerce_operands(x, y): if isinstance(y, (fmpz_mat, fmpq_mat, arb_mat)): diff --git a/src/flint/_arb_mat.pyx b/src/flint/_arb_mat.pyx index 607a4c2e..42a24920 100644 --- a/src/flint/_arb_mat.pyx +++ b/src/flint/_arb_mat.pyx @@ -9,7 +9,7 @@ from flint._arb cimport any_as_arb from flint._fmpz cimport fmpz from flint._fmpq cimport fmpq from flint._acb cimport acb -from flint.pyflint cimport acb_mat +from flint._acb_mat cimport acb_mat from flint._acb cimport any_as_acb from flint._flint cimport * diff --git a/src/flint/acb_series.pyx b/src/flint/acb_series.pyx index 0651d503..e91878e4 100644 --- a/src/flint/acb_series.pyx +++ b/src/flint/acb_series.pyx @@ -10,6 +10,8 @@ from flint._fmpq_poly cimport fmpq_poly from flint._arb_poly cimport arb_poly from flint._arb_poly cimport arb_poly_set_list from flint._acb_poly cimport acb_poly_set_list +from flint._arb cimport arb +from flint._acb_poly cimport acb_poly 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)): diff --git a/src/flint/dirichlet.pyx b/src/flint/dirichlet.pyx index 7a5fa2e5..c1710ab8 100644 --- a/src/flint/dirichlet.pyx +++ b/src/flint/dirichlet.pyx @@ -1,4 +1,5 @@ from flint.flint_base.flint_context cimport getprec +from flint._acb cimport any_as_acb cdef dict _dirichlet_group_cache = {} diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 9226edf5..698cf93d 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -1,4 +1,8 @@ from .utils.conversion cimport dps_to_prec +from flint._arb_mat cimport arb_mat +from flint._acb_mat cimport acb_mat +from flint._arb_poly cimport arb_poly +from flint._acb_poly cimport acb_poly # xxx: this doesn't work when changed to a cdef function. why? def __goodness(x, bint parts=True, metric=None): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 3af97620..46f18080 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -136,10 +136,10 @@ from flint._fmpq cimport fmpq # cpdef long nrows(self) # cpdef long ncols(self) -cdef class acb_mat(flint_mat): - cdef acb_mat_t val - cpdef long nrows(self) - cpdef long ncols(self) +# cdef class acb_mat(flint_mat): +# cdef acb_mat_t val +# cpdef long nrows(self) +# cpdef long ncols(self) # cdef class arb_series(flint_series): # cdef arb_poly_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index fd071aec..a131f678 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -54,7 +54,7 @@ include "fmpz_mpoly.pyx" # include "acb.pyx" # include "acb_poly.pyx" -include "acb_mat.pyx" +# tinclude "acb_mat.pyx" include "acb_series.pyx" include "functions.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index 65c951cf..a3bc21fa 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -70,7 +70,8 @@ def run_doctests(verbose=None): flint._arb_mat, flint._arb_series, flint._acb, - flint._acb_poly] + flint._acb_poly, + flint._acb_mat] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) From e395943cfc9ae52cbb625b24a9c4fdffda354093 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sun, 3 Sep 2023 10:36:20 -0400 Subject: [PATCH 22/39] Modularized acb_series --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/_acb_series.pxd | 10 ++++++++++ src/flint/{acb_series.pyx => _acb_series.pyx} | 8 ++++++++ src/flint/_arb_series.pyx | 2 +- src/flint/_fmpq_series.pyx | 2 +- src/flint/_fmpz_series.pyx | 2 +- src/flint/dirichlet.pyx | 1 + src/flint/functions.pyx | 4 ++++ src/flint/pyflint.pxd | 10 +++++----- src/flint/pyflint.pyx | 4 ++-- src/flint/test/__main__.py | 3 ++- 12 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 src/flint/_acb_series.pxd rename src/flint/{acb_series.pyx => _acb_series.pyx} (99%) diff --git a/setup.py b/setup.py index 5623c614..eedf501e 100644 --- a/setup.py +++ b/setup.py @@ -87,6 +87,7 @@ ("flint._acb", ["src/flint/_acb.pyx"]), ("flint._acb_poly", ["src/flint/_acb_poly.pyx"]), ("flint._acb_mat", ["src/flint/_acb_mat.pyx"]), + ("flint._acb_series", ["src/flint/_acb_series.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 e6cd6b81..b9312d38 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -19,4 +19,5 @@ from ._acb import * from ._acb_poly import * from ._acb_mat import * +from ._acb_series import * __version__ = '0.4.2' diff --git a/src/flint/_acb_series.pxd b/src/flint/_acb_series.pxd new file mode 100644 index 00000000..ed5d22ce --- /dev/null +++ b/src/flint/_acb_series.pxd @@ -0,0 +1,10 @@ +from flint.flint_base.flint_base cimport flint_series + +from flint._flint 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/_acb_series.pyx similarity index 99% rename from src/flint/acb_series.pyx rename to src/flint/_acb_series.pyx index e91878e4..8d6ce728 100644 --- a/src/flint/acb_series.pyx +++ b/src/flint/_acb_series.pyx @@ -12,6 +12,14 @@ from flint._arb_poly cimport arb_poly_set_list from flint._acb_poly cimport acb_poly_set_list from flint._arb cimport arb from flint._acb_poly cimport acb_poly +from flint.pyflint cimport dirichlet_char +from flint._fmpz cimport fmpz +from flint._fmpq cimport fmpq +from flint._fmpz cimport any_as_fmpz + +from flint._flint 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)): diff --git a/src/flint/_arb_series.pyx b/src/flint/_arb_series.pyx index 3cefa677..48b38a74 100644 --- a/src/flint/_arb_series.pyx +++ b/src/flint/_arb_series.pyx @@ -13,7 +13,7 @@ from flint._fmpz cimport fmpz from flint._fmpq cimport fmpq from flint._acb cimport acb from flint._acb_poly cimport acb_poly -from flint.pyflint cimport acb_series +from flint._acb_series cimport acb_series from flint._flint cimport * diff --git a/src/flint/_fmpq_series.pyx b/src/flint/_fmpq_series.pyx index 505b9a93..2b473b33 100644 --- a/src/flint/_fmpq_series.pyx +++ b/src/flint/_fmpq_series.pyx @@ -11,7 +11,7 @@ from flint._arb_poly cimport arb_poly from flint._arb_series cimport arb_series from flint._acb cimport acb from flint._acb_poly cimport acb_poly -from flint.pyflint cimport acb_series +from flint._acb_series cimport acb_series from flint.flint_base.flint_context cimport getcap from flint._fmpz cimport any_as_fmpz diff --git a/src/flint/_fmpz_series.pyx b/src/flint/_fmpz_series.pyx index c60b18c3..d8a914c4 100644 --- a/src/flint/_fmpz_series.pyx +++ b/src/flint/_fmpz_series.pyx @@ -13,7 +13,7 @@ from flint._arb_poly cimport arb_poly from flint._arb_series cimport arb_series from flint._acb cimport acb from flint._acb_poly cimport acb_poly -from flint.pyflint cimport acb_series +from flint._acb_series cimport acb_series from flint._flint cimport * diff --git a/src/flint/dirichlet.pyx b/src/flint/dirichlet.pyx index c1710ab8..eb296274 100644 --- a/src/flint/dirichlet.pyx +++ b/src/flint/dirichlet.pyx @@ -1,5 +1,6 @@ from flint.flint_base.flint_context cimport getprec from flint._acb cimport any_as_acb +from flint._acb cimport acb cdef dict _dirichlet_group_cache = {} diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 698cf93d..3f21afaf 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -3,6 +3,10 @@ from flint._arb_mat cimport arb_mat from flint._acb_mat cimport acb_mat from flint._arb_poly cimport arb_poly from flint._acb_poly cimport acb_poly +from flint._arb cimport arb +from flint._arb_series cimport arb_series +from flint._acb_series cimport acb_series + # xxx: this doesn't work when changed to a cdef function. why? def __goodness(x, bint parts=True, metric=None): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 46f18080..5c444457 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -147,11 +147,11 @@ from flint._fmpq cimport fmpq # cpdef long length(self) # cpdef valuation(self) -cdef class acb_series(flint_series): - cdef acb_poly_t val - cdef long prec - cpdef long length(self) - cpdef valuation(self) +# cdef class acb_series(flint_series): +# cdef acb_poly_t val +# cdef long prec +# cpdef long length(self) +# cpdef valuation(self) cdef class fmpz_mpoly_ctx: cdef fmpz_mpoly_ctx_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index a131f678..cbc407cf 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -54,8 +54,8 @@ include "fmpz_mpoly.pyx" # include "acb.pyx" # include "acb_poly.pyx" -# tinclude "acb_mat.pyx" -include "acb_series.pyx" +# include "acb_mat.pyx" +# include "acb_series.pyx" include "functions.pyx" diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index a3bc21fa..8ecfd16e 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -71,7 +71,8 @@ def run_doctests(verbose=None): flint._arb_series, flint._acb, flint._acb_poly, - flint._acb_mat] + flint._acb_mat, + flint._acb_series] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) From c60125225543858080cdc86295d552748ea5b484 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Sun, 3 Sep 2023 10:58:37 -0400 Subject: [PATCH 23/39] Modularized fmpz_mpoly --- setup.py | 1 + src/flint/__init__.py | 1 + src/flint/_fmpz_mpoly.pxd | 16 ++++++++++++++++ src/flint/{fmpz_mpoly.pyx => _fmpz_mpoly.pyx} | 5 +++++ src/flint/pyflint.pxd | 16 ++++++++-------- src/flint/pyflint.pyx | 2 +- 6 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 src/flint/_fmpz_mpoly.pxd rename src/flint/{fmpz_mpoly.pyx => _fmpz_mpoly.pyx} (99%) diff --git a/setup.py b/setup.py index eedf501e..157669cf 100644 --- a/setup.py +++ b/setup.py @@ -88,6 +88,7 @@ ("flint._acb_poly", ["src/flint/_acb_poly.pyx"]), ("flint._acb_mat", ["src/flint/_acb_mat.pyx"]), ("flint._acb_series", ["src/flint/_acb_series.pyx"]), + ("flint._fmpz_mpoly", ["src/flint/_fmpz_mpoly.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 b9312d38..22fa3405 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -20,4 +20,5 @@ from ._acb_poly import * from ._acb_mat import * from ._acb_series import * +from ._fmpz_mpoly import * __version__ = '0.4.2' diff --git a/src/flint/_fmpz_mpoly.pxd b/src/flint/_fmpz_mpoly.pxd new file mode 100644 index 00000000..5f5a134e --- /dev/null +++ b/src/flint/_fmpz_mpoly.pxd @@ -0,0 +1,16 @@ +from flint.flint_base.flint_base cimport flint_mpoly + +from flint._flint cimport fmpz_mpoly_ctx_t +from flint._flint 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/_fmpz_mpoly.pyx similarity index 99% rename from src/flint/fmpz_mpoly.pyx rename to src/flint/_fmpz_mpoly.pyx index 862f763d..3d6fdd80 100644 --- a/src/flint/fmpz_mpoly.pyx +++ b/src/flint/_fmpz_mpoly.pyx @@ -4,6 +4,11 @@ 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._fmpz cimport any_as_fmpz +from flint._fmpz cimport fmpz + +from flint._flint cimport * +cimport cython +cimport libc.stdlib cdef any_as_fmpz_mpoly(x): cdef fmpz_mpoly res diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 5c444457..ecc9f0f2 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -153,16 +153,16 @@ from flint._fmpq cimport fmpq # cpdef long length(self) # cpdef valuation(self) -cdef class fmpz_mpoly_ctx: - cdef fmpz_mpoly_ctx_t val - cpdef slong nvars(self) +# cdef class fmpz_mpoly_ctx: +# cdef fmpz_mpoly_ctx_t val +# cpdef slong nvars(self) - cpdef ordering(self) +# cpdef ordering(self) -cdef class fmpz_mpoly(flint_mpoly): - cdef fmpz_mpoly_t val - cdef fmpz_mpoly_ctx ctx - cdef bint _init +# cdef class fmpz_mpoly(flint_mpoly): +# cdef fmpz_mpoly_t val +# cdef fmpz_mpoly_ctx ctx +# cdef bint _init cdef class dirichlet_group(object): cdef dirichlet_group_t val diff --git a/src/flint/pyflint.pyx b/src/flint/pyflint.pyx index cbc407cf..7eacb7f1 100644 --- a/src/flint/pyflint.pyx +++ b/src/flint/pyflint.pyx @@ -32,7 +32,7 @@ ctx = thectx # include "fmpz.pyx" # include "fmpz_poly.pyx" -include "fmpz_mpoly.pyx" +# include "fmpz_mpoly.pyx" # include "fmpz_mat.pyx" # include "fmpz_series.pyx" From 3a7a2f71f1867de3e32128b78d8074e24b839257 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Mon, 4 Sep 2023 08:18:39 -0400 Subject: [PATCH 24/39] Added desired cdef to functions. --- src/flint/functions.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 3f21afaf..096c91d1 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -9,7 +9,7 @@ from flint._acb_series cimport acb_series # xxx: this doesn't work when changed to a cdef function. why? -def __goodness(x, bint parts=True, metric=None): +cdef __goodness(x, bint parts=True, metric=None): if metric is not None: x = metric(x) if isinstance(x, arb): From 529f79f4c5189b4228dfc6392859b725188ecb7a Mon Sep 17 00:00:00 2001 From: David Einstein Date: Mon, 4 Sep 2023 10:47:42 -0400 Subject: [PATCH 25/39] Moved everything into the types subdirectory. --- setup.py | 44 +++++++++---------- src/flint/__init__.py | 44 +++++++++---------- src/flint/dirichlet.pyx | 4 +- src/flint/functions.pyx | 16 +++---- src/flint/pyflint.pxd | 4 +- src/flint/test/__main__.py | 42 +++++++++--------- src/flint/{_acb.pxd => types/acb.pxd} | 0 src/flint/{_acb.pyx => types/acb.pyx} | 12 ++--- src/flint/{_acb_mat.pxd => types/acb_mat.pxd} | 0 src/flint/{_acb_mat.pyx => types/acb_mat.pyx} | 18 ++++---- .../{_acb_poly.pxd => types/acb_poly.pxd} | 0 .../{_acb_poly.pyx => types/acb_poly.pyx} | 18 ++++---- .../{_acb_series.pxd => types/acb_series.pxd} | 0 .../{_acb_series.pyx => types/acb_series.pyx} | 28 ++++++------ src/flint/{_arb.pxd => types/arb.pxd} | 0 src/flint/{_arb.pyx => types/arb.pyx} | 8 ++-- src/flint/{_arb_mat.pxd => types/arb_mat.pxd} | 0 src/flint/{_arb_mat.pyx => types/arb_mat.pyx} | 20 ++++----- .../{_arb_poly.pxd => types/arb_poly.pxd} | 0 .../{_arb_poly.pyx => types/arb_poly.pyx} | 18 ++++---- .../{_arb_series.pxd => types/arb_series.pxd} | 0 .../{_arb_series.pyx => types/arb_series.pyx} | 24 +++++----- src/flint/{_arf.pxd => types/arf.pxd} | 0 src/flint/{_arf.pyx => types/arf.pyx} | 6 +-- src/flint/{_fmpq.pxd => types/fmpq.pxd} | 0 src/flint/{_fmpq.pyx => types/fmpq.pyx} | 6 +-- .../{_fmpq_mat.pxd => types/fmpq_mat.pxd} | 6 +-- .../{_fmpq_mat.pyx => types/fmpq_mat.pyx} | 10 ++--- .../{_fmpq_poly.pxd => types/fmpq_poly.pxd} | 0 .../{_fmpq_poly.pyx => types/fmpq_poly.pyx} | 12 ++--- .../fmpq_series.pxd} | 0 .../fmpq_series.pyx} | 26 +++++------ src/flint/{_fmpz.pxd => types/fmpz.pxd} | 2 +- src/flint/{_fmpz.pyx => types/fmpz.pyx} | 0 .../{_fmpz_mat.pxd => types/fmpz_mat.pxd} | 2 +- .../{_fmpz_mat.pyx => types/fmpz_mat.pyx} | 12 ++--- .../{_fmpz_mpoly.pxd => types/fmpz_mpoly.pxd} | 0 .../{_fmpz_mpoly.pyx => types/fmpz_mpoly.pyx} | 4 +- .../{_fmpz_poly.pxd => types/fmpz_poly.pxd} | 0 .../{_fmpz_poly.pyx => types/fmpz_poly.pyx} | 22 +++++----- .../fmpz_series.pxd} | 0 .../fmpz_series.pyx} | 25 +++++------ src/flint/{_nmod.pxd => types/nmod.pxd} | 0 src/flint/{_nmod.pyx => types/nmod.pyx} | 8 ++-- .../{_nmod_mat.pxd => types/nmod_mat.pxd} | 0 .../{_nmod_mat.pyx => types/nmod_mat.pyx} | 8 ++-- .../{_nmod_poly.pxd => types/nmod_poly.pxd} | 0 .../{_nmod_poly.pyx => types/nmod_poly.pyx} | 8 ++-- .../nmod_series.pxd} | 0 .../nmod_series.pyx} | 0 50 files changed, 228 insertions(+), 229 deletions(-) rename src/flint/{_acb.pxd => types/acb.pxd} (100%) rename src/flint/{_acb.pyx => types/acb.pyx} (99%) rename src/flint/{_acb_mat.pxd => types/acb_mat.pxd} (100%) rename src/flint/{_acb_mat.pyx => types/acb_mat.pyx} (98%) rename src/flint/{_acb_poly.pxd => types/acb_poly.pxd} (100%) rename src/flint/{_acb_poly.pyx => types/acb_poly.pyx} (97%) rename src/flint/{_acb_series.pxd => types/acb_series.pxd} (100%) rename src/flint/{_acb_series.pyx => types/acb_series.pyx} (97%) rename src/flint/{_arb.pxd => types/arb.pxd} (100%) rename src/flint/{_arb.pyx => types/arb.pyx} (99%) rename src/flint/{_arb_mat.pxd => types/arb_mat.pxd} (100%) rename src/flint/{_arb_mat.pyx => types/arb_mat.pyx} (98%) rename src/flint/{_arb_poly.pxd => types/arb_poly.pxd} (100%) rename src/flint/{_arb_poly.pyx => types/arb_poly.pyx} (97%) rename src/flint/{_arb_series.pxd => types/arb_series.pxd} (100%) rename src/flint/{_arb_series.pyx => types/arb_series.pyx} (98%) rename src/flint/{_arf.pxd => types/arf.pxd} (100%) rename src/flint/{_arf.pyx => types/arf.pyx} (98%) rename src/flint/{_fmpq.pxd => types/fmpq.pxd} (100%) rename src/flint/{_fmpq.pyx => types/fmpq.pyx} (99%) rename src/flint/{_fmpq_mat.pxd => types/fmpq_mat.pxd} (78%) rename src/flint/{_fmpq_mat.pyx => types/fmpq_mat.pyx} (98%) rename src/flint/{_fmpq_poly.pxd => types/fmpq_poly.pxd} (100%) rename src/flint/{_fmpq_poly.pyx => types/fmpq_poly.pyx} (98%) rename src/flint/{_fmpq_series.pxd => types/fmpq_series.pxd} (100%) rename src/flint/{_fmpq_series.pyx => types/fmpq_series.pyx} (97%) rename src/flint/{_fmpz.pxd => types/fmpz.pxd} (100%) rename src/flint/{_fmpz.pyx => types/fmpz.pyx} (100%) rename src/flint/{_fmpz_mat.pxd => types/fmpz_mat.pxd} (88%) rename src/flint/{_fmpz_mat.pyx => types/fmpz_mat.pyx} (98%) rename src/flint/{_fmpz_mpoly.pxd => types/fmpz_mpoly.pxd} (100%) rename src/flint/{_fmpz_mpoly.pyx => types/fmpz_mpoly.pyx} (99%) rename src/flint/{_fmpz_poly.pxd => types/fmpz_poly.pxd} (100%) rename src/flint/{_fmpz_poly.pyx => types/fmpz_poly.pyx} (97%) rename src/flint/{_fmpz_series.pxd => types/fmpz_series.pxd} (100%) rename src/flint/{_fmpz_series.pyx => types/fmpz_series.pyx} (95%) rename src/flint/{_nmod.pxd => types/nmod.pxd} (100%) rename src/flint/{_nmod.pyx => types/nmod.pyx} (97%) rename src/flint/{_nmod_mat.pxd => types/nmod_mat.pxd} (100%) rename src/flint/{_nmod_mat.pyx => types/nmod_mat.pyx} (98%) rename src/flint/{_nmod_poly.pxd => types/nmod_poly.pxd} (100%) rename src/flint/{_nmod_poly.pyx => types/nmod_poly.pyx} (98%) rename src/flint/{_nmod_series.pxd => types/nmod_series.pxd} (100%) rename src/flint/{_nmod_series.pyx => types/nmod_series.pyx} (100%) diff --git a/setup.py b/setup.py index 157669cf..1d0a9b5d 100644 --- a/setup.py +++ b/setup.py @@ -67,28 +67,28 @@ # ("flint._flint", ["src/flint/_flint.pxd"]), # Main Module ("flint.pyflint", ["src/flint/pyflint.pyx"]), # Main Module # Submodules - ("flint._fmpz", ["src/flint/_fmpz.pyx"]), - ("flint._fmpz_poly", ["src/flint/_fmpz_poly.pyx"]), - ("flint._fmpz_mat", ["src/flint/_fmpz_mat.pyx"]), - ("flint._fmpz_series", ["src/flint/_fmpz_series.pyx"]), - ("flint._fmpq", ["src/flint/_fmpq.pyx"]), - ("flint._fmpq_poly", ["src/flint/_fmpq_poly.pyx"]), - ("flint._fmpq_mat", ["src/flint/_fmpq_mat.pyx"]), - ("flint._fmpq_series", ["src/flint/_fmpq_series.pyx"]), - ("flint._nmod", ["src/flint/_nmod.pyx"]), - ("flint._nmod_poly", ["src/flint/_nmod_poly.pyx"]), - ("flint._nmod_mat", ["src/flint/_nmod_mat.pyx"]), - ("flint._nmod_series", ["src/flint/_nmod_series.pyx"]), - ("flint._arf", ["src/flint/_arf.pyx"]), - ("flint._arb", ["src/flint/_arb.pyx"]), - ("flint._arb_poly", ["src/flint/_arb_poly.pyx"]), - ("flint._arb_mat", ["src/flint/_arb_mat.pyx"]), - ("flint._arb_series", ["src/flint/_arb_series.pyx"]), - ("flint._acb", ["src/flint/_acb.pyx"]), - ("flint._acb_poly", ["src/flint/_acb_poly.pyx"]), - ("flint._acb_mat", ["src/flint/_acb_mat.pyx"]), - ("flint._acb_series", ["src/flint/_acb_series.pyx"]), - ("flint._fmpz_mpoly", ["src/flint/_fmpz_mpoly.pyx"]), + ("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.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 22fa3405..68892edc 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -1,24 +1,24 @@ from .pyflint import * -from ._fmpz import * -from ._fmpz_poly import * -from ._fmpz_mat import * -from ._fmpz_series import * -from ._fmpq import * -from ._fmpq_poly import * -from ._fmpq_mat import * -from ._fmpq_series import * -from ._nmod import * -from ._nmod_poly import * -from ._nmod_mat import * -from ._nmod_series import * -from ._arf import * -from ._arb import * -from ._arb_poly import * -from ._arb_mat import * -from ._arb_series import * -from ._acb import * -from ._acb_poly import * -from ._acb_mat import * -from ._acb_series import * -from ._fmpz_mpoly 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/dirichlet.pyx b/src/flint/dirichlet.pyx index eb296274..52e382c3 100644 --- a/src/flint/dirichlet.pyx +++ b/src/flint/dirichlet.pyx @@ -1,6 +1,6 @@ from flint.flint_base.flint_context cimport getprec -from flint._acb cimport any_as_acb -from flint._acb cimport acb +from flint.types.acb cimport any_as_acb +from flint.types.acb cimport acb cdef dict _dirichlet_group_cache = {} diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 096c91d1..621521de 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -1,15 +1,15 @@ from .utils.conversion cimport dps_to_prec -from flint._arb_mat cimport arb_mat -from flint._acb_mat cimport acb_mat -from flint._arb_poly cimport arb_poly -from flint._acb_poly cimport acb_poly -from flint._arb cimport arb -from flint._arb_series cimport arb_series -from flint._acb_series cimport acb_series +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.arb_series cimport arb_series +from flint.types.acb_series cimport acb_series # xxx: this doesn't work when changed to a cdef function. why? -cdef __goodness(x, bint parts=True, metric=None): +def __goodness(x, bint parts=True, metric=None): if metric is not None: x = metric(x) if isinstance(x, arb): diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index ecc9f0f2..517a2828 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -5,7 +5,7 @@ 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._fmpz cimport fmpz +from flint.types.fmpz cimport fmpz from flint._flint cimport * cdef FMPZ_UNKNOWN = 0 @@ -44,7 +44,7 @@ cdef class Context: # cdef any_as_fmpq(obj) # cdef class fmpq(flint_scalar): # cdef fmpq_t val -from flint._fmpq cimport fmpq +from flint.types.fmpq cimport fmpq # cdef any_as_fmpq_poly(obj) # cdef class fmpq_poly(flint_poly): diff --git a/src/flint/test/__main__.py b/src/flint/test/__main__.py index 8ecfd16e..bd3cc558 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -52,27 +52,27 @@ def run_doctests(verbose=None): """Run the python-flint doctests""" # Here verbose=True shows a lot of output. modules = [flint.pyflint, - flint._fmpz, - flint._fmpz_poly, - flint._fmpz_mat, - flint._fmpz_series, - flint._fmpq, - flint._fmpq_poly, - flint._fmpq_mat, - flint._fmpq_series, - flint._nmod, - flint._nmod_poly, - flint._nmod_mat, - flint._nmod_series, - flint._arf, - flint._arb, - flint._arb_poly, - flint._arb_mat, - flint._arb_series, - flint._acb, - flint._acb_poly, - flint._acb_mat, - flint._acb_series] + 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] results = [doctest.testmod(x) for x in modules] # ffmpz, tfmpz = doctest.testmod(flint._fmpz, verbose=verbose) # failed, total = doctest.testmod(flint.pyflint, verbose=verbose) diff --git a/src/flint/_acb.pxd b/src/flint/types/acb.pxd similarity index 100% rename from src/flint/_acb.pxd rename to src/flint/types/acb.pxd diff --git a/src/flint/_acb.pyx b/src/flint/types/acb.pyx similarity index 99% rename from src/flint/_acb.pyx rename to src/flint/types/acb.pyx index b0aeda29..5edfd048 100644 --- a/src/flint/_acb.pyx +++ b/src/flint/types/acb.pyx @@ -5,12 +5,12 @@ 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._arb cimport arb_set_mpmath_mpf -from flint._arb cimport arb_set_python -from flint._arb cimport any_as_arb -from flint._arb cimport arb -from flint._fmpz cimport fmpz -from flint._fmpz cimport any_as_fmpz +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.pyflint cimport dirichlet_char from flint._flint cimport * diff --git a/src/flint/_acb_mat.pxd b/src/flint/types/acb_mat.pxd similarity index 100% rename from src/flint/_acb_mat.pxd rename to src/flint/types/acb_mat.pxd diff --git a/src/flint/_acb_mat.pyx b/src/flint/types/acb_mat.pyx similarity index 98% rename from src/flint/_acb_mat.pyx rename to src/flint/types/acb_mat.pyx index 2e2ee75f..0c702d38 100644 --- a/src/flint/_acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -1,15 +1,15 @@ 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._arb_mat cimport arb_mat -from flint._fmpz_mat cimport fmpz_mat -from flint._fmpq_mat cimport fmpq_mat -from flint._arb cimport arb -from flint._acb cimport acb -from flint._acb_poly cimport acb_poly -from flint._acb cimport any_as_acb -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq +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._flint cimport * cimport cython diff --git a/src/flint/_acb_poly.pxd b/src/flint/types/acb_poly.pxd similarity index 100% rename from src/flint/_acb_poly.pxd rename to src/flint/types/acb_poly.pxd diff --git a/src/flint/_acb_poly.pyx b/src/flint/types/acb_poly.pyx similarity index 97% rename from src/flint/_acb_poly.pyx rename to src/flint/types/acb_poly.pyx index cdbeb0ab..84af57e9 100644 --- a/src/flint/_acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -1,15 +1,15 @@ 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._fmpz_poly cimport fmpz_poly -from flint._fmpq_poly cimport fmpq_poly -from flint._arb_poly cimport arb_poly -from flint._acb cimport acb_set_python -from flint._acb cimport any_as_acb -from flint._acb cimport acb -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq -from flint._arb cimport arb +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._flint cimport * cimport libc.stdlib diff --git a/src/flint/_acb_series.pxd b/src/flint/types/acb_series.pxd similarity index 100% rename from src/flint/_acb_series.pxd rename to src/flint/types/acb_series.pxd diff --git a/src/flint/_acb_series.pyx b/src/flint/types/acb_series.pyx similarity index 97% rename from src/flint/_acb_series.pyx rename to src/flint/types/acb_series.pyx index 8d6ce728..8ab1dc10 100644 --- a/src/flint/_acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -1,21 +1,21 @@ 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._fmpz_series cimport fmpz_series -from flint._fmpq_series cimport fmpq_series -from flint._arb_series cimport arb_series -from flint._acb cimport acb -from flint._fmpz_poly cimport fmpz_poly -from flint._fmpq_poly cimport fmpq_poly -from flint._arb_poly cimport arb_poly -from flint._arb_poly cimport arb_poly_set_list -from flint._acb_poly cimport acb_poly_set_list -from flint._arb cimport arb -from flint._acb_poly cimport acb_poly +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.pyflint cimport dirichlet_char -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq -from flint._fmpz cimport any_as_fmpz +from flint.types.fmpz cimport fmpz +from flint.types.fmpq cimport fmpq +from flint.types.fmpz cimport any_as_fmpz from flint._flint cimport * cimport cython diff --git a/src/flint/_arb.pxd b/src/flint/types/arb.pxd similarity index 100% rename from src/flint/_arb.pxd rename to src/flint/types/arb.pxd diff --git a/src/flint/_arb.pyx b/src/flint/types/arb.pyx similarity index 99% rename from src/flint/_arb.pyx rename to src/flint/types/arb.pyx index c37443f9..0982a41c 100644 --- a/src/flint/_arb.pyx +++ b/src/flint/types/arb.pyx @@ -5,10 +5,10 @@ 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, _str_trunc -from flint._fmpz cimport fmpz_set_pylong -from flint._arf cimport arf -from flint._fmpq cimport fmpq -from flint._fmpz cimport fmpz +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 * cimport libc.stdlib diff --git a/src/flint/_arb_mat.pxd b/src/flint/types/arb_mat.pxd similarity index 100% rename from src/flint/_arb_mat.pxd rename to src/flint/types/arb_mat.pxd diff --git a/src/flint/_arb_mat.pyx b/src/flint/types/arb_mat.pyx similarity index 98% rename from src/flint/_arb_mat.pyx rename to src/flint/types/arb_mat.pyx index 42a24920..78b4b0b1 100644 --- a/src/flint/_arb_mat.pyx +++ b/src/flint/types/arb_mat.pyx @@ -1,16 +1,16 @@ 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._fmpq_mat cimport fmpq_mat -from flint._fmpz_mat cimport fmpz_mat -from flint._arb cimport arb -from flint._arb_poly cimport arb_poly -from flint._arb cimport any_as_arb -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq -from flint._acb cimport acb -from flint._acb_mat cimport acb_mat -from flint._acb cimport any_as_acb +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._flint cimport * cimport cython diff --git a/src/flint/_arb_poly.pxd b/src/flint/types/arb_poly.pxd similarity index 100% rename from src/flint/_arb_poly.pxd rename to src/flint/types/arb_poly.pxd diff --git a/src/flint/_arb_poly.pyx b/src/flint/types/arb_poly.pyx similarity index 97% rename from src/flint/_arb_poly.pyx rename to src/flint/types/arb_poly.pyx index 25465ea7..81c8d451 100644 --- a/src/flint/_arb_poly.pyx +++ b/src/flint/types/arb_poly.pyx @@ -1,15 +1,15 @@ 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._fmpq_poly cimport fmpq_poly -from flint._fmpz_poly cimport fmpz_poly -from flint._arb cimport arb_set_python -from flint._arb cimport any_as_arb -from flint._arb cimport arb -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq -from flint._acb cimport acb -from flint._acb_poly cimport acb_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._flint cimport * cimport cython diff --git a/src/flint/_arb_series.pxd b/src/flint/types/arb_series.pxd similarity index 100% rename from src/flint/_arb_series.pxd rename to src/flint/types/arb_series.pxd diff --git a/src/flint/_arb_series.pyx b/src/flint/types/arb_series.pyx similarity index 98% rename from src/flint/_arb_series.pyx rename to src/flint/types/arb_series.pyx index 48b38a74..cad49b53 100644 --- a/src/flint/_arb_series.pyx +++ b/src/flint/types/arb_series.pyx @@ -2,18 +2,18 @@ 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._fmpz_series cimport fmpz_series -from flint._fmpz_poly cimport fmpz_poly -from flint._fmpq_series cimport fmpq_series -from flint._fmpq_poly cimport fmpq_poly -from flint._arb_poly cimport arb_poly_set_list -from flint._arb cimport arb -from flint._arb_poly cimport arb_poly -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq -from flint._acb cimport acb -from flint._acb_poly cimport acb_poly -from flint._acb_series cimport acb_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._flint cimport * diff --git a/src/flint/_arf.pxd b/src/flint/types/arf.pxd similarity index 100% rename from src/flint/_arf.pxd rename to src/flint/types/arf.pxd diff --git a/src/flint/_arf.pyx b/src/flint/types/arf.pyx similarity index 98% rename from src/flint/_arf.pyx rename to src/flint/types/arf.pyx index 08c19278..07366a00 100644 --- a/src/flint/_arf.pyx +++ b/src/flint/types/arf.pyx @@ -2,9 +2,9 @@ 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._fmpz cimport fmpz -from flint._fmpz cimport any_as_fmpz -from flint._arb cimport arb +from flint.types.fmpz cimport fmpz +from flint.types.fmpz cimport any_as_fmpz +from flint.types.arb cimport arb from flint._flint cimport * diff --git a/src/flint/_fmpq.pxd b/src/flint/types/fmpq.pxd similarity index 100% rename from src/flint/_fmpq.pxd rename to src/flint/types/fmpq.pxd diff --git a/src/flint/_fmpq.pyx b/src/flint/types/fmpq.pyx similarity index 99% rename from src/flint/_fmpq.pyx rename to src/flint/types/fmpq.pyx index e6f814b0..4e3a7cff 100644 --- a/src/flint/_fmpq.pyx +++ b/src/flint/types/fmpq.pyx @@ -1,8 +1,8 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck -from flint._fmpz cimport fmpz_set_any_ref -from flint._fmpz cimport fmpz -from flint._fmpz cimport any_as_fmpz +from flint.types.fmpz cimport fmpz_set_any_ref +from flint.types.fmpz cimport fmpz +from flint.types.fmpz cimport any_as_fmpz cdef FMPZ_UNKNOWN = 0 cdef FMPZ_REF = 1 diff --git a/src/flint/_fmpq_mat.pxd b/src/flint/types/fmpq_mat.pxd similarity index 78% rename from src/flint/_fmpq_mat.pxd rename to src/flint/types/fmpq_mat.pxd index ef32fba6..6713516d 100644 --- a/src/flint/_fmpq_mat.pxd +++ b/src/flint/types/fmpq_mat.pxd @@ -1,9 +1,9 @@ from flint.flint_base.flint_base cimport flint_mat from flint._flint cimport fmpq_mat_t -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq -from flint._fmpz_mat cimport fmpz_mat +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 diff --git a/src/flint/_fmpq_mat.pyx b/src/flint/types/fmpq_mat.pyx similarity index 98% rename from src/flint/_fmpq_mat.pyx rename to src/flint/types/fmpq_mat.pyx index 6f2ba265..9b63b4af 100644 --- a/src/flint/_fmpq_mat.pyx +++ b/src/flint/types/fmpq_mat.pyx @@ -1,10 +1,10 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck -from flint._fmpq_poly cimport fmpq_poly -from flint._fmpq cimport any_as_fmpq -from flint._fmpz_poly cimport fmpz_poly -from flint._fmpq_poly cimport fmpq_poly_set_list -from flint._fmpz cimport any_as_fmpz +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._flint cimport * cimport cython diff --git a/src/flint/_fmpq_poly.pxd b/src/flint/types/fmpq_poly.pxd similarity index 100% rename from src/flint/_fmpq_poly.pxd rename to src/flint/types/fmpq_poly.pxd diff --git a/src/flint/_fmpq_poly.pyx b/src/flint/types/fmpq_poly.pyx similarity index 98% rename from src/flint/_fmpq_poly.pyx rename to src/flint/types/fmpq_poly.pyx index 0267337b..a537f11d 100644 --- a/src/flint/_fmpq_poly.pyx +++ b/src/flint/types/fmpq_poly.pyx @@ -1,11 +1,11 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_poly -from flint._fmpz_poly cimport any_as_fmpz_poly -from flint._fmpz_poly cimport fmpz_poly -from flint._fmpq cimport fmpq -from flint._fmpq cimport any_as_fmpq -from flint._fmpz cimport fmpz -from flint._fmpz cimport any_as_fmpz +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._flint cimport * diff --git a/src/flint/_fmpq_series.pxd b/src/flint/types/fmpq_series.pxd similarity index 100% rename from src/flint/_fmpq_series.pxd rename to src/flint/types/fmpq_series.pxd diff --git a/src/flint/_fmpq_series.pyx b/src/flint/types/fmpq_series.pyx similarity index 97% rename from src/flint/_fmpq_series.pyx rename to src/flint/types/fmpq_series.pyx index 2b473b33..111b12fe 100644 --- a/src/flint/_fmpq_series.pyx +++ b/src/flint/types/fmpq_series.pyx @@ -1,19 +1,19 @@ from flint.flint_base.flint_base cimport flint_series from flint.utils.typecheck cimport typecheck -from flint._fmpz_series cimport fmpz_series -from flint._fmpq_poly cimport fmpq_poly -from flint._fmpq_poly cimport fmpq_poly_set_list -from flint._fmpz cimport fmpz -from flint._fmpz_poly cimport fmpz_poly -from flint._fmpq cimport fmpq -from flint._arb cimport arb -from flint._arb_poly cimport arb_poly -from flint._arb_series cimport arb_series -from flint._acb cimport acb -from flint._acb_poly cimport acb_poly -from flint._acb_series cimport acb_series from flint.flint_base.flint_context cimport getcap -from flint._fmpz cimport any_as_fmpz +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._flint cimport * diff --git a/src/flint/_fmpz.pxd b/src/flint/types/fmpz.pxd similarity index 100% rename from src/flint/_fmpz.pxd rename to src/flint/types/fmpz.pxd index 14300bb7..d94d989f 100644 --- a/src/flint/_fmpz.pxd +++ b/src/flint/types/fmpz.pxd @@ -1,9 +1,9 @@ from flint.flint_base.flint_base cimport flint_scalar +from flint.utils.conversion cimport chars_from_str from flint._flint cimport fmpz_t, slong, pylong_as_slong from flint._flint cimport PyObject, fmpz_set_str, fmpz_set_si from flint._flint cimport PyInt_Check, PyInt_AS_LONG, PyLong_Check -from flint.utils.conversion cimport chars_from_str from cpython.version cimport PY_MAJOR_VERSION diff --git a/src/flint/_fmpz.pyx b/src/flint/types/fmpz.pyx similarity index 100% rename from src/flint/_fmpz.pyx rename to src/flint/types/fmpz.pyx diff --git a/src/flint/_fmpz_mat.pxd b/src/flint/types/fmpz_mat.pxd similarity index 88% rename from src/flint/_fmpz_mat.pxd rename to src/flint/types/fmpz_mat.pxd index ae9f73c6..b4554858 100644 --- a/src/flint/_fmpz_mat.pxd +++ b/src/flint/types/fmpz_mat.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_mat from flint._flint cimport fmpz_mat_t -from flint._fmpz cimport fmpz +from flint.types.fmpz cimport fmpz cdef any_as_fmpz_mat(obj) cdef class fmpz_mat(flint_mat): diff --git a/src/flint/_fmpz_mat.pyx b/src/flint/types/fmpz_mat.pyx similarity index 98% rename from src/flint/_fmpz_mat.pyx rename to src/flint/types/fmpz_mat.pyx index a2b6f214..c2d390ff 100644 --- a/src/flint/_fmpz_mat.pyx +++ b/src/flint/types/fmpz_mat.pyx @@ -1,12 +1,12 @@ from flint.flint_base.flint_base cimport flint_mat from flint.utils.typecheck cimport typecheck -from flint._fmpz cimport fmpz -from flint._fmpz_poly cimport fmpz_poly -from flint._fmpq_mat cimport fmpq_mat -from flint._fmpz cimport any_as_fmpz -from flint._fmpq cimport fmpq +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._fmpq cimport any_as_fmpq +from flint.types.fmpq cimport any_as_fmpq cimport cython from flint._flint cimport * diff --git a/src/flint/_fmpz_mpoly.pxd b/src/flint/types/fmpz_mpoly.pxd similarity index 100% rename from src/flint/_fmpz_mpoly.pxd rename to src/flint/types/fmpz_mpoly.pxd diff --git a/src/flint/_fmpz_mpoly.pyx b/src/flint/types/fmpz_mpoly.pyx similarity index 99% rename from src/flint/_fmpz_mpoly.pyx rename to src/flint/types/fmpz_mpoly.pyx index 3d6fdd80..fe226f05 100644 --- a/src/flint/_fmpz_mpoly.pyx +++ b/src/flint/types/fmpz_mpoly.pyx @@ -3,8 +3,8 @@ 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._fmpz cimport any_as_fmpz -from flint._fmpz cimport fmpz +from flint.types.fmpz cimport any_as_fmpz +from flint.types.fmpz cimport fmpz from flint._flint cimport * cimport cython diff --git a/src/flint/_fmpz_poly.pxd b/src/flint/types/fmpz_poly.pxd similarity index 100% rename from src/flint/_fmpz_poly.pxd rename to src/flint/types/fmpz_poly.pxd diff --git a/src/flint/_fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx similarity index 97% rename from src/flint/_fmpz_poly.pyx rename to src/flint/types/fmpz_poly.pyx index 1fd0dc43..7f9c65e7 100644 --- a/src/flint/_fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -3,17 +3,17 @@ from cpython.version cimport PY_MAJOR_VERSION 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._fmpz cimport fmpz_set_python -from flint._fmpz cimport any_as_fmpz -from flint._fmpz cimport fmpz -from flint._fmpq cimport any_as_fmpq -from flint._fmpq cimport fmpq -from flint._fmpq_poly cimport fmpq_poly -from flint._fmpq_poly cimport any_as_fmpq_poly -from flint._acb cimport acb -from flint._arb cimport any_as_arb_or_notimplemented -from flint._arb cimport arb -from flint._acb cimport any_as_acb_or_notimplemented +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._flint cimport * diff --git a/src/flint/_fmpz_series.pxd b/src/flint/types/fmpz_series.pxd similarity index 100% rename from src/flint/_fmpz_series.pxd rename to src/flint/types/fmpz_series.pxd diff --git a/src/flint/_fmpz_series.pyx b/src/flint/types/fmpz_series.pyx similarity index 95% rename from src/flint/_fmpz_series.pyx rename to src/flint/types/fmpz_series.pyx index d8a914c4..ae239d29 100644 --- a/src/flint/_fmpz_series.pyx +++ b/src/flint/types/fmpz_series.pyx @@ -1,19 +1,18 @@ from flint.utils.typecheck cimport typecheck from flint.flint_base.flint_base cimport flint_series -from flint._fmpz_poly cimport fmpz_poly_set_list -from flint._fmpz cimport fmpz -from flint._fmpz_poly cimport fmpz_poly from flint.flint_base.flint_context cimport getcap - -from flint._fmpq cimport fmpq -from flint._fmpq_poly cimport fmpq_poly -from flint._fmpq_series cimport fmpq_series -from flint._arb cimport arb -from flint._arb_poly cimport arb_poly -from flint._arb_series cimport arb_series -from flint._acb cimport acb -from flint._acb_poly cimport acb_poly -from flint._acb_series cimport acb_series +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._flint cimport * diff --git a/src/flint/_nmod.pxd b/src/flint/types/nmod.pxd similarity index 100% rename from src/flint/_nmod.pxd rename to src/flint/types/nmod.pxd diff --git a/src/flint/_nmod.pyx b/src/flint/types/nmod.pyx similarity index 97% rename from src/flint/_nmod.pyx rename to src/flint/types/nmod.pyx index 7e2281cc..7e675da1 100644 --- a/src/flint/_nmod.pyx +++ b/src/flint/types/nmod.pyx @@ -1,9 +1,9 @@ from flint.flint_base.flint_base cimport flint_scalar from flint.utils.typecheck cimport typecheck -from flint._fmpq cimport any_as_fmpq -from flint._fmpz cimport any_as_fmpz -from flint._fmpz cimport fmpz -from flint._fmpq cimport fmpq +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._flint cimport * diff --git a/src/flint/_nmod_mat.pxd b/src/flint/types/nmod_mat.pxd similarity index 100% rename from src/flint/_nmod_mat.pxd rename to src/flint/types/nmod_mat.pxd diff --git a/src/flint/_nmod_mat.pyx b/src/flint/types/nmod_mat.pyx similarity index 98% rename from src/flint/_nmod_mat.pyx rename to src/flint/types/nmod_mat.pyx index 5845e507..8ae20e46 100644 --- a/src/flint/_nmod_mat.pyx +++ b/src/flint/types/nmod_mat.pyx @@ -1,9 +1,9 @@ from flint.utils.conversion cimport matrix_to_str from flint.utils.typecheck cimport typecheck -from flint._fmpz_mat cimport any_as_fmpz_mat -from flint._fmpz_mat cimport fmpz_mat -from flint._nmod cimport nmod -from flint._nmod cimport any_as_nmod +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 diff --git a/src/flint/_nmod_poly.pxd b/src/flint/types/nmod_poly.pxd similarity index 100% rename from src/flint/_nmod_poly.pxd rename to src/flint/types/nmod_poly.pxd diff --git a/src/flint/_nmod_poly.pyx b/src/flint/types/nmod_poly.pyx similarity index 98% rename from src/flint/_nmod_poly.pyx rename to src/flint/types/nmod_poly.pyx index 745d5068..ed7bcd74 100644 --- a/src/flint/_nmod_poly.pyx +++ b/src/flint/types/nmod_poly.pyx @@ -1,9 +1,9 @@ from flint.flint_base.flint_base cimport flint_poly from flint.utils.typecheck cimport typecheck -from flint._fmpz_poly cimport any_as_fmpz_poly -from flint._fmpz_poly cimport fmpz_poly -from flint._nmod cimport any_as_nmod -from flint._nmod cimport nmod +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._flint cimport * diff --git a/src/flint/_nmod_series.pxd b/src/flint/types/nmod_series.pxd similarity index 100% rename from src/flint/_nmod_series.pxd rename to src/flint/types/nmod_series.pxd 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 From ec86fcd7ec32b904b0e387944c9f7d23ed244025 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Mon, 4 Sep 2023 14:57:49 -0400 Subject: [PATCH 26/39] Modularized dirichlet Also changed FMPZ_ENUM etc to be an enum, and deleted bunches of commented dead code. --- setup.py | 1 + src/flint/_flint.pxd | 8 +- src/flint/functions.pyx | 1 + src/flint/pyflint.pxd | 160 ---------------------------- src/flint/pyflint.pyx | 47 -------- src/flint/test/__main__.py | 3 +- src/flint/types/acb.pyx | 6 +- src/flint/types/acb_series.pyx | 2 +- src/flint/types/arb.pyx | 3 - src/flint/{ => types}/dirichlet.pyx | 5 + src/flint/types/fmpq.pyx | 4 - src/flint/types/fmpz.pyx | 27 ----- 12 files changed, 16 insertions(+), 251 deletions(-) rename src/flint/{ => types}/dirichlet.pyx (97%) diff --git a/setup.py b/setup.py index 1d0a9b5d..e1de4165 100644 --- a/setup.py +++ b/setup.py @@ -89,6 +89,7 @@ ("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/_flint.pxd b/src/flint/_flint.pxd index 166e14a6..47163d00 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -15,9 +15,11 @@ cdef extern from "Python.h": long PyLong_AsLongAndOverflow(PyObject *pylong, int *overflow) long long PyLong_AsLongLongAndOverflow(PyObject *pylong, int *overflow) -DEF FMPZ_UNKNOWN = 0 -DEF FMPZ_REF = 1 -DEF FMPZ_TMP = 2 +cdef enum: + FMPZ_UNKNOWN = 0 + FMPZ_REF = 1 + FMPZ_TMP = 2 + # # Note: ulong and slong are used throughout Flint/Arb. They are expected to be diff --git a/src/flint/functions.pyx b/src/flint/functions.pyx index 621521de..d70e9961 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -4,6 +4,7 @@ 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 diff --git a/src/flint/pyflint.pxd b/src/flint/pyflint.pxd index 517a2828..53a09575 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -8,169 +8,9 @@ from flint.flint_base.flint_base cimport flint_poly from flint.types.fmpz cimport fmpz from flint._flint cimport * -cdef FMPZ_UNKNOWN = 0 -cdef FMPZ_REF = 1 -cdef FMPZ_TMP = 2 - - cdef flint_rand_t global_random_state cdef class Context: cdef public bint pretty cdef public long prec cdef arf_rnd_t rnd - - - - -#cdef class fmpz: -# cdef fmpz_t val - -#cdef class fmpz_poly: -# cdef fmpz_poly_t val - -# 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) - -# cdef class fmpz_series(flint_series): -# cdef fmpz_poly_t val -# cdef long prec -# cpdef long length(self) -# cpdef valuation(self) - -# cdef any_as_fmpq(obj) -# cdef class fmpq(flint_scalar): -# cdef fmpq_t val -from flint.types.fmpq cimport fmpq - -# 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) - -# from flint.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) - -# 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) - -# cdef class nmod(flint_scalar): -# cdef mp_limb_t val -# cdef nmod_t mod - -# 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) - -# 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) - -# cdef class nmod_series(flint_series): -# pass - # cdef nmod_poly_t val - # cdef long prec - -# 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) - -# cdef any_as_arb_or_notimplemented(x) -# 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) - - -# cdef any_as_acb(x) -# cdef any_as_acb_or_notimplemented(x) -# cdef class acb(flint_scalar): -# cdef acb_t val -# cpdef bint is_zero(self) -# cpdef bint is_finite(self) -# cpdef bint is_exact(self) - -# cdef class arb_poly(flint_poly): -# cdef arb_poly_t val -# cpdef long length(self) -# cpdef long degree(self) - -# cdef class acb_poly(flint_poly): -# cdef acb_poly_t val -# cpdef long length(self) -# cpdef long degree(self) - - -# cdef class arb_mat(flint_mat): -# cdef arb_mat_t val -# cpdef long nrows(self) -# cpdef long ncols(self) - -# cdef class acb_mat(flint_mat): -# cdef acb_mat_t val -# cpdef long nrows(self) -# cpdef long ncols(self) - -# cdef class arb_series(flint_series): -# cdef arb_poly_t val -# cdef long prec -# cpdef long length(self) -# cpdef valuation(self) - -# cdef class acb_series(flint_series): -# cdef acb_poly_t val -# cdef long prec -# cpdef long length(self) -# cpdef valuation(self) - -# 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 - -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/pyflint.pyx b/src/flint/pyflint.pyx index 7eacb7f1..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 bd3cc558..dbd15c03 100644 --- a/src/flint/test/__main__.py +++ b/src/flint/test/__main__.py @@ -72,7 +72,8 @@ def run_doctests(verbose=None): flint.types.acb, flint.types.acb_poly, flint.types.acb_mat, - flint.types.acb_series] + 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) diff --git a/src/flint/types/acb.pyx b/src/flint/types/acb.pyx index 5edfd048..3016d6b5 100644 --- a/src/flint/types/acb.pyx +++ b/src/flint/types/acb.pyx @@ -11,16 +11,12 @@ 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.pyflint cimport dirichlet_char +from flint.types.dirichlet cimport dirichlet_char from flint._flint cimport * cimport libc.stdlib cimport cython -cdef FMPZ_UNKNOWN = 0 -cdef FMPZ_REF = 1 -cdef FMPZ_TMP = 2 - ctx = thectx cdef int acb_set_python(acb_t x, obj, bint allow_conversion): diff --git a/src/flint/types/acb_series.pyx b/src/flint/types/acb_series.pyx index 8ab1dc10..e59bfa15 100644 --- a/src/flint/types/acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -12,7 +12,7 @@ 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.pyflint cimport dirichlet_char +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 diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index 0982a41c..733e8cb7 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -16,9 +16,6 @@ cimport cython ctx = thectx -cdef FMPZ_UNKNOWN = 0 -cdef FMPZ_REF = 1 -cdef FMPZ_TMP = 2 # cdef _str_trunc(s, trunc=0): # if trunc > 0 and len(s) > 3 * trunc: # left = right = trunc diff --git a/src/flint/dirichlet.pyx b/src/flint/types/dirichlet.pyx similarity index 97% rename from src/flint/dirichlet.pyx rename to src/flint/types/dirichlet.pyx index 52e382c3..b8893131 100644 --- a/src/flint/dirichlet.pyx +++ b/src/flint/types/dirichlet.pyx @@ -1,6 +1,9 @@ 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._flint cimport * cdef dict _dirichlet_group_cache = {} @@ -169,6 +172,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 @@ -189,6 +193,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.pyx b/src/flint/types/fmpq.pyx index 4e3a7cff..d3c0f7c8 100644 --- a/src/flint/types/fmpq.pyx +++ b/src/flint/types/fmpq.pyx @@ -4,10 +4,6 @@ from flint.types.fmpz cimport fmpz_set_any_ref from flint.types.fmpz cimport fmpz from flint.types.fmpz cimport any_as_fmpz -cdef FMPZ_UNKNOWN = 0 -cdef FMPZ_REF = 1 -cdef FMPZ_TMP = 2 - from flint._flint cimport * cdef any_as_fmpq(obj): diff --git a/src/flint/types/fmpz.pyx b/src/flint/types/fmpz.pyx index ce11e698..4da6447d 100644 --- a/src/flint/types/fmpz.pyx +++ b/src/flint/types/fmpz.pyx @@ -6,35 +6,8 @@ from flint.utils.conversion cimport chars_from_str from flint.utils.conversion cimport str_from_chars, _str_trunc cimport libc.stdlib -#from flint.fmpz cimport fmpz from flint._flint cimport * -cdef FMPZ_UNKNOWN = 0 -cdef FMPZ_REF = 1 -cdef FMPZ_TMP = 2 - -from flint._flint cimport * - - -# 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 fmpz_get_intlong(fmpz_t x): """ Convert fmpz_t to a Python int or long. From 7898c361651812e22f5d6a537840b92028448a38 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Mon, 4 Sep 2023 18:01:29 -0400 Subject: [PATCH 27/39] Added dirichlet.pxd This should have gone in the last commit. --- src/flint/types/__init__.py | 0 src/flint/types/dirichlet.pxd | 13 +++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/flint/types/__init__.py create mode 100644 src/flint/types/dirichlet.pxd 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/dirichlet.pxd b/src/flint/types/dirichlet.pxd new file mode 100644 index 00000000..c2a5d925 --- /dev/null +++ b/src/flint/types/dirichlet.pxd @@ -0,0 +1,13 @@ +from flint._flint cimport dirichlet_group_t +from flint._flint 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 From 217365186be326c2055dc66ad1f82c03faa6771c Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 09:44:26 -0400 Subject: [PATCH 28/39] Interim commit. Splitting _flint.pxd into pieces About 1/3 done --- src/flint/_flint.pxd | 1396 ++++++++++++----------- src/flint/flintlib/__init__.py | 0 src/flint/flintlib/arith.pxd | 23 + src/flint/flintlib/fmpq.pxd | 49 + src/flint/flintlib/fmpq_mat.pxd | 60 + src/flint/flintlib/fmpq_poly.pxd | 119 ++ src/flint/flintlib/fmpz.pxd | 103 ++ src/flint/flintlib/fmpz_factor.pxd | 18 + src/flint/flintlib/fmpz_lll.pxd | 13 + src/flint/flintlib/fmpz_mat.pxd | 58 + src/flint/flintlib/fmpz_poly.pxd | 114 ++ src/flint/flintlib/fmpz_poly_factor.pxd | 8 + src/flint/flintlib/nmod_mat.pxd | 53 + src/flint/flintlib/nmod_poly.pxd | 85 ++ src/flint/flintlib/nmod_vec.pxd | 13 + src/flint/flintlib/ulong_extras.pxd | 5 + src/flint/types/acb_mat.pyx | 2 + src/flint/types/acb_poly.pyx | 3 +- src/flint/types/arb.pyx | 14 +- src/flint/types/arb_mat.pyx | 2 + src/flint/types/arb_poly.pyx | 3 +- src/flint/types/arf.pyx | 3 +- src/flint/types/dirichlet.pyx | 2 + src/flint/types/fmpq.pyx | 7 + src/flint/types/fmpq_mat.pyx | 5 + src/flint/types/fmpq_poly.pyx | 10 +- src/flint/types/fmpq_series.pyx | 2 + src/flint/types/fmpz.pxd | 12 +- src/flint/types/fmpz.pyx | 13 +- src/flint/types/fmpz_mat.pyx | 8 + src/flint/types/fmpz_poly.pyx | 18 +- src/flint/types/fmpz_series.pyx | 2 + src/flint/types/nmod.pyx | 4 + src/flint/types/nmod_mat.pyx | 4 +- src/flint/types/nmod_poly.pyx | 6 +- src/flint/utils/typecheck.pxd | 2 +- 36 files changed, 1520 insertions(+), 719 deletions(-) create mode 100644 src/flint/flintlib/__init__.py create mode 100644 src/flint/flintlib/arith.pxd create mode 100644 src/flint/flintlib/fmpq.pxd create mode 100644 src/flint/flintlib/fmpq_mat.pxd create mode 100644 src/flint/flintlib/fmpq_poly.pxd create mode 100644 src/flint/flintlib/fmpz.pxd create mode 100644 src/flint/flintlib/fmpz_factor.pxd create mode 100644 src/flint/flintlib/fmpz_lll.pxd create mode 100644 src/flint/flintlib/fmpz_mat.pxd create mode 100644 src/flint/flintlib/fmpz_poly.pxd create mode 100644 src/flint/flintlib/fmpz_poly_factor.pxd create mode 100644 src/flint/flintlib/nmod_mat.pxd create mode 100644 src/flint/flintlib/nmod_poly.pxd create mode 100644 src/flint/flintlib/nmod_vec.pxd create mode 100644 src/flint/flintlib/ulong_extras.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 47163d00..6283e337 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -4,16 +4,16 @@ 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 @@ -70,690 +70,698 @@ 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) +from flint.flintlib.nmod_vec cimport nmod_t +from flint.flintlib.nmod_poly cimport nmod_poly_t +from flint.flintlib.nmod_mat cimport nmod_mat_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) + +# 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) + +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) + +# 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) +from flint.flintlib.fmpz_poly cimport fmpz_poly_t, fmpz_poly_struct +from flint.flintlib.fmpz_mat cimport fmpz_mat_struct, fmpz_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) + +# 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) + +from flint.flintlib.fmpq cimport fmpq_t, fmpq_struct +from flint.flintlib.fmpq_poly cimport fmpq_poly_struct, fmpq_poly_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) + +# 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) +from flint.flintlib.fmpq_mat cimport fmpq_mat_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) cdef extern from "mag.h": ctypedef struct mag_struct: 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/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/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_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/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/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/types/acb_mat.pyx b/src/flint/types/acb_mat.pyx index 0c702d38..59c9fbcb 100644 --- a/src/flint/types/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -11,6 +11,8 @@ 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._flint cimport * cimport cython diff --git a/src/flint/types/acb_poly.pyx b/src/flint/types/acb_poly.pyx index 84af57e9..2d339919 100644 --- a/src/flint/types/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -1,3 +1,4 @@ +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 @@ -22,7 +23,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): diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index 733e8cb7..88f98617 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -1,4 +1,8 @@ +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 @@ -11,6 +15,8 @@ from flint.types.fmpq cimport fmpq from flint.types.fmpz cimport fmpz from flint._flint cimport * +from flint.flintlib.fmpz cimport fmpz_init, fmpz_clear + cimport libc.stdlib cimport cython @@ -75,11 +81,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) @@ -87,7 +93,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 diff --git a/src/flint/types/arb_mat.pyx b/src/flint/types/arb_mat.pyx index 78b4b0b1..3345a7bf 100644 --- a/src/flint/types/arb_mat.pyx +++ b/src/flint/types/arb_mat.pyx @@ -12,6 +12,8 @@ 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._flint cimport * cimport cython diff --git a/src/flint/types/arb_poly.pyx b/src/flint/types/arb_poly.pyx index 81c8d451..ea997b8b 100644 --- a/src/flint/types/arb_poly.pyx +++ b/src/flint/types/arb_poly.pyx @@ -1,3 +1,4 @@ +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 @@ -25,7 +26,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): diff --git a/src/flint/types/arf.pyx b/src/flint/types/arf.pyx index 07366a00..8fbf24f6 100644 --- a/src/flint/types/arf.pyx +++ b/src/flint/types/arf.pyx @@ -1,3 +1,4 @@ +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 @@ -41,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.pyx b/src/flint/types/dirichlet.pyx index b8893131..b479f43e 100644 --- a/src/flint/types/dirichlet.pyx +++ b/src/flint/types/dirichlet.pyx @@ -4,6 +4,8 @@ from flint.types.acb cimport acb from flint.types.fmpz cimport fmpz from flint._flint cimport * +from flint.flintlib.ulong_extras cimport n_gcd +from flint.flintlib.fmpz cimport fmpz_get_ui cdef dict _dirichlet_group_cache = {} diff --git a/src/flint/types/fmpq.pyx b/src/flint/types/fmpq.pyx index d3c0f7c8..d75eadc3 100644 --- a/src/flint/types/fmpq.pyx +++ b/src/flint/types/fmpq.pyx @@ -5,6 +5,13 @@ from flint.types.fmpz cimport fmpz from flint.types.fmpz cimport any_as_fmpz from flint._flint cimport * +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 * cdef any_as_fmpq(obj): if typecheck(obj, fmpq): diff --git a/src/flint/types/fmpq_mat.pyx b/src/flint/types/fmpq_mat.pyx index 9b63b4af..6ce3e893 100644 --- a/src/flint/types/fmpq_mat.pyx +++ b/src/flint/types/fmpq_mat.pyx @@ -6,7 +6,12 @@ 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._flint cimport * +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): diff --git a/src/flint/types/fmpq_poly.pyx b/src/flint/types/fmpq_poly.pyx index a537f11d..fec5c1fe 100644 --- a/src/flint/types/fmpq_poly.pyx +++ b/src/flint/types/fmpq_poly.pyx @@ -1,3 +1,4 @@ +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 @@ -8,6 +9,13 @@ from flint.types.fmpz cimport fmpz from flint.types.fmpz cimport any_as_fmpz from flint._flint cimport * +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): @@ -31,7 +39,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] diff --git a/src/flint/types/fmpq_series.pyx b/src/flint/types/fmpq_series.pyx index 111b12fe..270dda67 100644 --- a/src/flint/types/fmpq_series.pyx +++ b/src/flint/types/fmpq_series.pyx @@ -16,6 +16,8 @@ from flint.types.acb_series cimport acb_series from flint.types.fmpz cimport any_as_fmpz from flint._flint cimport * +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)): diff --git a/src/flint/types/fmpz.pxd b/src/flint/types/fmpz.pxd index d94d989f..bf800df9 100644 --- a/src/flint/types/fmpz.pxd +++ b/src/flint/types/fmpz.pxd @@ -1,9 +1,11 @@ +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 fmpz_t, slong, pylong_as_slong -from flint._flint cimport PyObject, fmpz_set_str, fmpz_set_si -from flint._flint cimport PyInt_Check, PyInt_AS_LONG, PyLong_Check +from flint._flint cimport PyObject +from flint.flintlib.fmpz cimport fmpz_set_str, fmpz_set_si from cpython.version cimport PY_MAJOR_VERSION @@ -20,10 +22,10 @@ cdef inline int fmpz_set_pylong(fmpz_t x, obj): 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)) + if PY_MAJOR_VERSION < 3 and PyInt_Check(obj): + fmpz_set_si(x, PyInt_AS_LONG(obj)) return 1 - if PyLong_Check(obj): + if PyLong_Check(obj): fmpz_set_pylong(x, obj) return 1 return 0 diff --git a/src/flint/types/fmpz.pyx b/src/flint/types/fmpz.pyx index 4da6447d..44b5b056 100644 --- a/src/flint/types/fmpz.pyx +++ b/src/flint/types/fmpz.pyx @@ -7,6 +7,9 @@ from flint.utils.conversion cimport str_from_chars, _str_trunc cimport libc.stdlib from flint._flint cimport * +from flint.flintlib.fmpz cimport * +from flint.flintlib.fmpz_factor cimport * +from flint.flintlib.arith cimport * cdef fmpz_get_intlong(fmpz_t x): """ @@ -25,11 +28,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 @@ -126,8 +129,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.pyx b/src/flint/types/fmpz_mat.pyx index c2d390ff..133568c5 100644 --- a/src/flint/types/fmpz_mat.pyx +++ b/src/flint/types/fmpz_mat.pyx @@ -10,6 +10,14 @@ from flint.types.fmpq cimport any_as_fmpq cimport cython from flint._flint cimport * +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): diff --git a/src/flint/types/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx index 7f9c65e7..c031ee18 100644 --- a/src/flint/types/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -1,4 +1,8 @@ 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 @@ -15,8 +19,14 @@ 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._flint 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 * cdef any_as_fmpz_poly(x): cdef fmpz_poly res @@ -26,11 +36,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) @@ -40,7 +50,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: diff --git a/src/flint/types/fmpz_series.pyx b/src/flint/types/fmpz_series.pyx index ae239d29..d2473519 100644 --- a/src/flint/types/fmpz_series.pyx +++ b/src/flint/types/fmpz_series.pyx @@ -15,6 +15,8 @@ from flint.types.acb_poly cimport acb_poly from flint.types.acb_series cimport acb_series from flint._flint cimport * +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)): diff --git a/src/flint/types/nmod.pyx b/src/flint/types/nmod.pyx index 7e675da1..59045790 100644 --- a/src/flint/types/nmod.pyx +++ b/src/flint/types/nmod.pyx @@ -6,6 +6,10 @@ from flint.types.fmpz cimport fmpz from flint.types.fmpq cimport fmpq from flint._flint cimport * +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 diff --git a/src/flint/types/nmod_mat.pyx b/src/flint/types/nmod_mat.pyx index 8ae20e46..1419ad6e 100644 --- a/src/flint/types/nmod_mat.pyx +++ b/src/flint/types/nmod_mat.pyx @@ -10,7 +10,9 @@ from flint.flint_base.flint_context cimport thectx cimport cython from flint._flint cimport * - +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): diff --git a/src/flint/types/nmod_poly.pyx b/src/flint/types/nmod_poly.pyx index ed7bcd74..33dfd665 100644 --- a/src/flint/types/nmod_poly.pyx +++ b/src/flint/types/nmod_poly.pyx @@ -1,3 +1,4 @@ +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 @@ -6,6 +7,9 @@ from flint.types.nmod cimport any_as_nmod from flint.types.nmod cimport nmod from flint._flint cimport * +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 @@ -31,7 +35,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] 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) From 47e41f488ce81b80c1ea7489a564d349d40646c5 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 12:34:44 -0400 Subject: [PATCH 29/39] Split mag.h into its own .pxd Going to commit after each include because cython is getting weird (or I'm going insane). --- src/flint/_flint.pxd | 30 ++++++++++++++++-------------- src/flint/flintlib/__init__.pxd | 0 src/flint/flintlib/mag.pxd | 17 +++++++++++++++++ src/flint/types/acb.pyx | 2 ++ src/flint/types/acb_mat.pyx | 1 + src/flint/types/acb_poly.pyx | 1 + src/flint/types/arb.pyx | 1 + 7 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 src/flint/flintlib/__init__.pxd create mode 100644 src/flint/flintlib/mag.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 6283e337..1978bac2 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -763,20 +763,22 @@ from flint.flintlib.fmpq_mat cimport fmpq_mat_t # 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 "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) + +from flint.flintlib.mag cimport mag_struct, mag_t, mag_ptr, mag_srcptr cdef extern from "arf.h": ctypedef struct arf_struct: 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/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/types/acb.pyx b/src/flint/types/acb.pyx index 3016d6b5..9c01fc63 100644 --- a/src/flint/types/acb.pyx +++ b/src/flint/types/acb.pyx @@ -14,6 +14,8 @@ from flint.types.fmpz cimport any_as_fmpz from flint.types.dirichlet cimport dirichlet_char from flint._flint cimport * +from flint.flintlib.mag cimport * + cimport libc.stdlib cimport cython diff --git a/src/flint/types/acb_mat.pyx b/src/flint/types/acb_mat.pyx index 59c9fbcb..4cc1911b 100644 --- a/src/flint/types/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -14,6 +14,7 @@ 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._flint cimport * +from flint.flintlib.mag cimport * cimport cython cdef acb_mat_coerce_operands(x, y): diff --git a/src/flint/types/acb_poly.pyx b/src/flint/types/acb_poly.pyx index 2d339919..0874529b 100644 --- a/src/flint/types/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -13,6 +13,7 @@ from flint.types.fmpq cimport fmpq from flint.types.arb cimport arb from flint._flint cimport * +from flint.flintlib.mag cimport * cimport libc.stdlib cdef acb_poly_coerce_operands(x, y): diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index 88f98617..b144f491 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -15,6 +15,7 @@ from flint.types.fmpq cimport fmpq from flint.types.fmpz cimport fmpz from flint._flint cimport * +from flint.flintlib.mag cimport * from flint.flintlib.fmpz cimport fmpz_init, fmpz_clear cimport libc.stdlib From 34532a09c21cf48ed43efe99aeaed27ee548fe31 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 13:58:52 -0400 Subject: [PATCH 30/39] Split arb.h from _flint --- src/flint/_flint.pxd | 1126 +----------------------- src/flint/flint_base/flint_context.pyx | 2 +- src/flint/flintlib/arb.pxd | 296 +++++++ src/flint/flintlib/arf.pxd | 138 +++ src/flint/functions.pyx | 1 + src/flint/types/acb.pyx | 2 + src/flint/types/acb_mat.pyx | 2 + src/flint/types/acb_poly.pyx | 1 + src/flint/types/arb.pyx | 2 + src/flint/types/arb_mat.pyx | 2 + src/flint/types/arb_poly.pyx | 1 + src/flint/types/arb_series.pyx | 1 + src/flint/types/arf.pyx | 1 + 13 files changed, 451 insertions(+), 1124 deletions(-) create mode 100644 src/flint/flintlib/arb.pxd create mode 100644 src/flint/flintlib/arf.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 1978bac2..71599f58 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -73,1137 +73,17 @@ cdef extern from *: from flint.flintlib.nmod_vec cimport nmod_t from flint.flintlib.nmod_poly cimport nmod_poly_t from flint.flintlib.nmod_mat cimport nmod_mat_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) - -# 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) - 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) - -# 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) from flint.flintlib.fmpz_poly cimport fmpz_poly_t, fmpz_poly_struct from flint.flintlib.fmpz_mat cimport fmpz_mat_struct, fmpz_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) - -# 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) - from flint.flintlib.fmpq cimport fmpq_t, fmpq_struct from flint.flintlib.fmpq_poly cimport fmpq_poly_struct, fmpq_poly_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) - -# 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) from flint.flintlib.fmpq_mat cimport fmpq_mat_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) - -# 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) - from flint.flintlib.mag cimport mag_struct, mag_t, mag_ptr, mag_srcptr -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) +from flint.flintlib.arf cimport arf_struct, arf_t, arf_ptr, arf_srcptr, arf_rnd_t +from flint.flintlib.arb cimport arb_struct, arb_ptr, arb_srcptr, arb_t +from flint.flintlib.arb cimport arb_midref, arb_radref cdef extern from "acb.h": ctypedef struct acb_struct: 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/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/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/functions.pyx b/src/flint/functions.pyx index d70e9961..170ca0b1 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -7,6 +7,7 @@ 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 * # xxx: this doesn't work when changed to a cdef function. why? diff --git a/src/flint/types/acb.pyx b/src/flint/types/acb.pyx index 9c01fc63..0c74e8e2 100644 --- a/src/flint/types/acb.pyx +++ b/src/flint/types/acb.pyx @@ -15,6 +15,8 @@ from flint.types.dirichlet cimport dirichlet_char from flint._flint cimport * from flint.flintlib.mag cimport * +from flint.flintlib.arb cimport * +from flint.flintlib.arf cimport * cimport libc.stdlib cimport cython diff --git a/src/flint/types/acb_mat.pyx b/src/flint/types/acb_mat.pyx index 4cc1911b..b34248a1 100644 --- a/src/flint/types/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -15,6 +15,8 @@ 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._flint cimport * from flint.flintlib.mag cimport * +from flint.flintlib.arb cimport * +from flint.flintlib.arf cimport * cimport cython cdef acb_mat_coerce_operands(x, y): diff --git a/src/flint/types/acb_poly.pyx b/src/flint/types/acb_poly.pyx index 0874529b..675f53da 100644 --- a/src/flint/types/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -14,6 +14,7 @@ from flint.types.arb cimport arb from flint._flint cimport * from flint.flintlib.mag cimport * +from flint.flintlib.arf cimport * cimport libc.stdlib cdef acb_poly_coerce_operands(x, y): diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index b144f491..e3d140f3 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -17,6 +17,8 @@ from flint.types.fmpz cimport fmpz from flint._flint cimport * from flint.flintlib.mag cimport * from flint.flintlib.fmpz cimport fmpz_init, fmpz_clear +from flint.flintlib.arf cimport * +from flint.flintlib.arb cimport * cimport libc.stdlib cimport cython diff --git a/src/flint/types/arb_mat.pyx b/src/flint/types/arb_mat.pyx index 3345a7bf..385e2e84 100644 --- a/src/flint/types/arb_mat.pyx +++ b/src/flint/types/arb_mat.pyx @@ -15,6 +15,8 @@ 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._flint cimport * +from flint.flintlib.arf cimport * +from flint.flintlib.arb cimport * cimport cython cdef arb_mat_coerce_operands(x, y): diff --git a/src/flint/types/arb_poly.pyx b/src/flint/types/arb_poly.pyx index ea997b8b..95031bef 100644 --- a/src/flint/types/arb_poly.pyx +++ b/src/flint/types/arb_poly.pyx @@ -13,6 +13,7 @@ from flint.types.acb cimport acb from flint.types.acb_poly cimport acb_poly from flint._flint cimport * +from flint.flintlib.arb cimport * cimport cython cimport libc.stdlib diff --git a/src/flint/types/arb_series.pyx b/src/flint/types/arb_series.pyx index cad49b53..7e4c90d7 100644 --- a/src/flint/types/arb_series.pyx +++ b/src/flint/types/arb_series.pyx @@ -16,6 +16,7 @@ from flint.types.acb_poly cimport acb_poly from flint.types.acb_series cimport acb_series from flint._flint cimport * +from flint.flintlib.arb cimport * ctx = thectx diff --git a/src/flint/types/arf.pyx b/src/flint/types/arf.pyx index 8fbf24f6..aafd237e 100644 --- a/src/flint/types/arf.pyx +++ b/src/flint/types/arf.pyx @@ -8,6 +8,7 @@ from flint.types.fmpz cimport any_as_fmpz from flint.types.arb cimport arb from flint._flint cimport * +from flint.flintlib.arf cimport * ctx = thectx From 35690596987eade8ac3f5374594cf973313b3ef4 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 14:30:02 -0400 Subject: [PATCH 31/39] split acb.h from _flint. --- src/flint/_flint.pxd | 192 +------------------------------- src/flint/flintlib/acb.pxd | 197 +++++++++++++++++++++++++++++++++ src/flint/functions.pyx | 1 + src/flint/types/acb.pyx | 1 + src/flint/types/acb_mat.pyx | 2 + src/flint/types/acb_poly.pyx | 1 + src/flint/types/acb_series.pyx | 1 + src/flint/types/fmpz_poly.pyx | 1 + 8 files changed, 206 insertions(+), 190 deletions(-) create mode 100644 src/flint/flintlib/acb.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 71599f58..d2f3f993 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -84,197 +84,9 @@ from flint.flintlib.mag cimport mag_struct, mag_t, mag_ptr, mag_srcptr from flint.flintlib.arf cimport arf_struct, arf_t, arf_ptr, arf_srcptr, arf_rnd_t from flint.flintlib.arb cimport arb_struct, arb_ptr, arb_srcptr, arb_t from flint.flintlib.arb cimport arb_midref, arb_radref +from flint.flintlib.acb cimport acb_struct, acb_ptr, acb_srcptr, acb_t +from flint.flintlib.acb cimport acb_realref, acb_imagref -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) 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/functions.pyx b/src/flint/functions.pyx index 170ca0b1..4512d5b7 100644 --- a/src/flint/functions.pyx +++ b/src/flint/functions.pyx @@ -8,6 +8,7 @@ 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? diff --git a/src/flint/types/acb.pyx b/src/flint/types/acb.pyx index 0c74e8e2..d46dfd32 100644 --- a/src/flint/types/acb.pyx +++ b/src/flint/types/acb.pyx @@ -17,6 +17,7 @@ from flint._flint cimport * from flint.flintlib.mag cimport * from flint.flintlib.arb cimport * from flint.flintlib.arf cimport * +from flint.flintlib.acb cimport * cimport libc.stdlib cimport cython diff --git a/src/flint/types/acb_mat.pyx b/src/flint/types/acb_mat.pyx index b34248a1..109be8ee 100644 --- a/src/flint/types/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -17,6 +17,8 @@ from flint._flint cimport * from flint.flintlib.mag cimport * from flint.flintlib.arb cimport * from flint.flintlib.arf cimport * +from flint.flintlib.acb cimport * + cimport cython cdef acb_mat_coerce_operands(x, y): diff --git a/src/flint/types/acb_poly.pyx b/src/flint/types/acb_poly.pyx index 675f53da..84d59402 100644 --- a/src/flint/types/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -15,6 +15,7 @@ from flint.types.arb cimport arb from flint._flint cimport * from flint.flintlib.mag cimport * from flint.flintlib.arf cimport * +from flint.flintlib.acb cimport * cimport libc.stdlib cdef acb_poly_coerce_operands(x, y): diff --git a/src/flint/types/acb_series.pyx b/src/flint/types/acb_series.pyx index e59bfa15..226a51df 100644 --- a/src/flint/types/acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -16,6 +16,7 @@ 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._flint cimport * cimport cython diff --git a/src/flint/types/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx index c031ee18..4a284527 100644 --- a/src/flint/types/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -27,6 +27,7 @@ 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 * cdef any_as_fmpz_poly(x): cdef fmpz_poly res From 2d6099093e30ffdedabaee701504c60d1d2056c9 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 14:40:35 -0400 Subject: [PATCH 32/39] Split partitions.h and bernoulli.h from _flint --- src/flint/_flint.pxd | 10 +++++----- src/flint/flintlib/bernoulli.pxd | 6 ++++++ src/flint/flintlib/partitions.pxd | 4 ++++ src/flint/types/fmpq.pyx | 1 + src/flint/types/fmpz.pyx | 1 + 5 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 src/flint/flintlib/bernoulli.pxd create mode 100644 src/flint/flintlib/partitions.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index d2f3f993..007832ad 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -88,12 +88,12 @@ from flint.flintlib.acb cimport acb_struct, acb_ptr, acb_srcptr, acb_t from flint.flintlib.acb cimport acb_realref, acb_imagref -cdef extern from "partitions.h": - void partitions_fmpz_fmpz(fmpz_t, const fmpz_t, int) +# 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 "bernoulli.h": +# void bernoulli_fmpq_ui(fmpq_t, ulong) +# void bernoulli_cache_compute(long n) cdef extern from "arb_poly.h": 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/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/types/fmpq.pyx b/src/flint/types/fmpq.pyx index d75eadc3..d1fc4267 100644 --- a/src/flint/types/fmpq.pyx +++ b/src/flint/types/fmpq.pyx @@ -12,6 +12,7 @@ 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): diff --git a/src/flint/types/fmpz.pyx b/src/flint/types/fmpz.pyx index 44b5b056..e44f0914 100644 --- a/src/flint/types/fmpz.pyx +++ b/src/flint/types/fmpz.pyx @@ -10,6 +10,7 @@ from flint._flint cimport * 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): """ From 3601b76715f989600d7e78376ce81b47ec0ab433 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 15:32:38 -0400 Subject: [PATCH 33/39] Split arb poly from _flint --- src/flint/_flint.pxd | 217 +------------------------------- src/flint/flintlib/arb_poly.pxd | 213 +++++++++++++++++++++++++++++++ src/flint/types/arb_poly.pyx | 1 + src/flint/types/arb_series.pyx | 1 + src/flint/types/fmpz_poly.pyx | 1 + 5 files changed, 217 insertions(+), 216 deletions(-) create mode 100644 src/flint/flintlib/arb_poly.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 007832ad..7b741c9c 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -86,224 +86,9 @@ from flint.flintlib.arb cimport arb_struct, arb_ptr, arb_srcptr, arb_t from flint.flintlib.arb cimport arb_midref, arb_radref from flint.flintlib.acb cimport acb_struct, acb_ptr, acb_srcptr, acb_t from flint.flintlib.acb cimport acb_realref, acb_imagref +from flint.flintlib.arb_poly cimport arb_poly_struct, arb_poly_t -# 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 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/types/arb_poly.pyx b/src/flint/types/arb_poly.pyx index 95031bef..7df1bd11 100644 --- a/src/flint/types/arb_poly.pyx +++ b/src/flint/types/arb_poly.pyx @@ -14,6 +14,7 @@ from flint.types.acb_poly cimport acb_poly from flint._flint cimport * from flint.flintlib.arb cimport * +from flint.flintlib.arb_poly cimport * cimport cython cimport libc.stdlib diff --git a/src/flint/types/arb_series.pyx b/src/flint/types/arb_series.pyx index 7e4c90d7..5343bf5c 100644 --- a/src/flint/types/arb_series.pyx +++ b/src/flint/types/arb_series.pyx @@ -17,6 +17,7 @@ from flint.types.acb_series cimport acb_series from flint._flint cimport * from flint.flintlib.arb cimport * +from flint.flintlib.arb_poly cimport * ctx = thectx diff --git a/src/flint/types/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx index 4a284527..410a2267 100644 --- a/src/flint/types/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -28,6 +28,7 @@ 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 * cdef any_as_fmpz_poly(x): cdef fmpz_poly res From 2aa64a485cc7d33874de25ccb6b4f72bdadbb07c Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 15:49:56 -0400 Subject: [PATCH 34/39] Peeled arb_mat from _flint --- src/flint/_flint.pxd | 83 +------------------------------ src/flint/flintlib/arb_mat.pxd | 89 ++++++++++++++++++++++++++++++++++ src/flint/types/acb_mat.pyx | 1 + src/flint/types/arb_mat.pyx | 1 + 4 files changed, 92 insertions(+), 82 deletions(-) create mode 100644 src/flint/flintlib/arb_mat.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 7b741c9c..8c4a4edb 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -87,88 +87,7 @@ from flint.flintlib.arb cimport arb_midref, arb_radref from flint.flintlib.acb cimport acb_struct, acb_ptr, acb_srcptr, acb_t from flint.flintlib.acb cimport acb_realref, acb_imagref from flint.flintlib.arb_poly cimport arb_poly_struct, 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) +from flint.flintlib.arb_mat cimport arb_mat_struct, arb_mat_t cdef extern from "acb_poly.h": ctypedef struct acb_poly_struct: 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/types/acb_mat.pyx b/src/flint/types/acb_mat.pyx index 109be8ee..cc77946f 100644 --- a/src/flint/types/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -16,6 +16,7 @@ from flint.flintlib.fmpq_mat cimport fmpq_mat_nrows, fmpq_mat_ncols from flint._flint cimport * 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 * diff --git a/src/flint/types/arb_mat.pyx b/src/flint/types/arb_mat.pyx index 385e2e84..86952266 100644 --- a/src/flint/types/arb_mat.pyx +++ b/src/flint/types/arb_mat.pyx @@ -17,6 +17,7 @@ from flint.flintlib.fmpq_mat cimport fmpq_mat_nrows, fmpq_mat_ncols from flint._flint cimport * 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): From 9bdcdc12ac62568ddd71d0a30dd0ecfba9363743 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 16:34:17 -0400 Subject: [PATCH 35/39] Split acb_poly from _flint --- src/flint/_flint.pxd | 205 +----------------------------- src/flint/flintlib/acb_poly.pxd | 212 ++++++++++++++++++++++++++++++++ src/flint/types/acb_poly.pyx | 1 + src/flint/types/acb_series.pyx | 1 + 4 files changed, 215 insertions(+), 204 deletions(-) create mode 100644 src/flint/flintlib/acb_poly.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 8c4a4edb..aeec0565 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -88,211 +88,8 @@ from flint.flintlib.acb cimport acb_struct, acb_ptr, acb_srcptr, acb_t from flint.flintlib.acb cimport acb_realref, acb_imagref from flint.flintlib.arb_poly cimport arb_poly_struct, arb_poly_t from flint.flintlib.arb_mat cimport arb_mat_struct, arb_mat_t +from flint.flintlib.acb_poly cimport acb_poly_struct, acb_poly_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) cdef extern from "acb_mat.h": ctypedef struct acb_mat_struct: 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/types/acb_poly.pyx b/src/flint/types/acb_poly.pyx index 84d59402..2368ac52 100644 --- a/src/flint/types/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -16,6 +16,7 @@ from flint._flint cimport * from flint.flintlib.mag cimport * from flint.flintlib.arf cimport * from flint.flintlib.acb cimport * +from flint.flintlib.acb_poly cimport * cimport libc.stdlib cdef acb_poly_coerce_operands(x, y): diff --git a/src/flint/types/acb_series.pyx b/src/flint/types/acb_series.pyx index 226a51df..5837c236 100644 --- a/src/flint/types/acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -17,6 +17,7 @@ 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._flint cimport * cimport cython From 8b660558dc7a5e42ea0d47735b7926346140b452 Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 19:14:20 -0400 Subject: [PATCH 36/39] extracted acb_mat, acb_hypgeom, acb_modular and arb_hypgeom from _flint --- src/flint/_flint.pxd | 250 +---------------------------- src/flint/flintlib/acb_hypgeom.pxd | 81 ++++++++++ src/flint/flintlib/acb_mat.pxd | 97 +++++++++++ src/flint/flintlib/acb_modular.pxd | 19 +++ src/flint/flintlib/arb_hypgeom.pxd | 69 ++++++++ src/flint/types/acb.pyx | 2 + src/flint/types/acb_mat.pyx | 1 + src/flint/types/acb_series.pyx | 2 + src/flint/types/arb.pyx | 1 + src/flint/types/arb_series.pyx | 1 + src/flint/types/fmpz_poly.pyx | 2 +- 11 files changed, 275 insertions(+), 250 deletions(-) create mode 100644 src/flint/flintlib/acb_hypgeom.pxd create mode 100644 src/flint/flintlib/acb_mat.pxd create mode 100644 src/flint/flintlib/acb_modular.pxd create mode 100644 src/flint/flintlib/arb_hypgeom.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index aeec0565..e323d7e4 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -89,257 +89,9 @@ from flint.flintlib.acb cimport acb_realref, acb_imagref from flint.flintlib.arb_poly cimport arb_poly_struct, arb_poly_t from flint.flintlib.arb_mat cimport arb_mat_struct, arb_mat_t from flint.flintlib.acb_poly cimport acb_poly_struct, acb_poly_t +from flint.flintlib.acb_mat cimport acb_mat_struct, acb_mat_t -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 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..d4e481fe --- /dev/null +++ b/src/flint/flintlib/acb_mat.pxd @@ -0,0 +1,97 @@ +from flint.flintlib.acb cimport acb_ptr, acb_struct, acb_t, acb_srcptr +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, flint_rand_t +from flint.flintlib.fmpz cimport fmpz_t +from flint.flintlib.acb_poly cimport acb_poly_t +from flint.flintlib.arb cimport arb_t + +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/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/types/acb.pyx b/src/flint/types/acb.pyx index d46dfd32..392f8332 100644 --- a/src/flint/types/acb.pyx +++ b/src/flint/types/acb.pyx @@ -18,6 +18,8 @@ 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 * cimport libc.stdlib cimport cython diff --git a/src/flint/types/acb_mat.pyx b/src/flint/types/acb_mat.pyx index cc77946f..ffba33d2 100644 --- a/src/flint/types/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -19,6 +19,7 @@ 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 diff --git a/src/flint/types/acb_series.pyx b/src/flint/types/acb_series.pyx index 5837c236..9407c516 100644 --- a/src/flint/types/acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -18,6 +18,8 @@ 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._flint cimport * cimport cython diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index e3d140f3..7bb77e80 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -19,6 +19,7 @@ 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 * cimport libc.stdlib cimport cython diff --git a/src/flint/types/arb_series.pyx b/src/flint/types/arb_series.pyx index 5343bf5c..772c5ef0 100644 --- a/src/flint/types/arb_series.pyx +++ b/src/flint/types/arb_series.pyx @@ -18,6 +18,7 @@ from flint.types.acb_series cimport acb_series from flint._flint cimport * from flint.flintlib.arb cimport * from flint.flintlib.arb_poly cimport * +from flint.flintlib.arb_hypgeom cimport * ctx = thectx diff --git a/src/flint/types/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx index 410a2267..a774f0bd 100644 --- a/src/flint/types/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -21,7 +21,7 @@ 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._flint cimport * from flint.flintlib.ulong_extras cimport n_is_prime from flint.flintlib.fmpz_poly cimport * From d734daff1e0040c5d76003f8e46d0e19bfa630fc Mon Sep 17 00:00:00 2001 From: David Einstein Date: Tue, 5 Sep 2023 23:30:07 -0400 Subject: [PATCH 37/39] Merge the rest of the include files out of _flint All that is left are the structures, but moving them makes things strange --- src/flint/_flint.pxd | 314 +-------------------------- src/flint/flintlib/acb_calc.pxd | 22 ++ src/flint/flintlib/acb_dft.pxd | 5 + src/flint/flintlib/acb_dirichlet.pxd | 24 ++ src/flint/flintlib/acb_elliptic.pxd | 16 ++ src/flint/flintlib/acb_mat.pxd | 4 +- src/flint/flintlib/arb_fmpz_poly.pxd | 11 + src/flint/flintlib/dirichlet.pxd | 61 ++++++ src/flint/flintlib/fmpz_mpoly.pxd | 169 ++++++++++++++ src/flint/flintlib/mpoly.pxd | 21 ++ src/flint/types/acb.pyx | 4 + src/flint/types/acb_mat.pxd | 3 +- src/flint/types/acb_poly.pxd | 2 +- src/flint/types/acb_series.pxd | 2 +- src/flint/types/acb_series.pyx | 1 + src/flint/types/arb.pyx | 1 + src/flint/types/dirichlet.pxd | 4 +- src/flint/types/dirichlet.pyx | 2 + src/flint/types/fmpz_mpoly.pxd | 4 +- src/flint/types/fmpz_mpoly.pyx | 1 + src/flint/types/fmpz_poly.pyx | 1 + 21 files changed, 353 insertions(+), 319 deletions(-) create mode 100644 src/flint/flintlib/acb_calc.pxd create mode 100644 src/flint/flintlib/acb_dft.pxd create mode 100644 src/flint/flintlib/acb_dirichlet.pxd create mode 100644 src/flint/flintlib/acb_elliptic.pxd create mode 100644 src/flint/flintlib/arb_fmpz_poly.pxd create mode 100644 src/flint/flintlib/dirichlet.pxd create mode 100644 src/flint/flintlib/fmpz_mpoly.pxd create mode 100644 src/flint/flintlib/mpoly.pxd diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index e323d7e4..09ba307c 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -88,317 +88,13 @@ from flint.flintlib.acb cimport acb_struct, acb_ptr, acb_srcptr, acb_t from flint.flintlib.acb cimport acb_realref, acb_imagref from flint.flintlib.arb_poly cimport arb_poly_struct, arb_poly_t from flint.flintlib.arb_mat cimport arb_mat_struct, arb_mat_t -from flint.flintlib.acb_poly cimport acb_poly_struct, acb_poly_t -from flint.flintlib.acb_mat cimport acb_mat_struct, acb_mat_t +# from flint.flintlib.acb_poly cimport acb_poly_struct, acb_poly_t +# from flint.flintlib.acb_mat cimport acb_mat_struct, acb_mat_t +# from flint.flintlib.dirichlet cimport dirichlet_group_struct, dirichlet_group_t +# from flint.flintlib.dirichlet cimport dirichlet_char_struct, dirichlet_char_t +# from flint.flintlib.mpoly cimport ordering_t, mpoly_ctx_struct, mpoly_ctx_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) - -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/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_mat.pxd b/src/flint/flintlib/acb_mat.pxd index d4e481fe..fa2023e4 100644 --- a/src/flint/flintlib/acb_mat.pxd +++ b/src/flint/flintlib/acb_mat.pxd @@ -1,11 +1,11 @@ -from flint.flintlib.acb cimport acb_ptr, acb_struct, acb_t, acb_srcptr +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._flint cimport ulong, flint_rand_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: 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/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/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/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/types/acb.pyx b/src/flint/types/acb.pyx index 392f8332..afa12aea 100644 --- a/src/flint/types/acb.pyx +++ b/src/flint/types/acb.pyx @@ -20,6 +20,10 @@ 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 diff --git a/src/flint/types/acb_mat.pxd b/src/flint/types/acb_mat.pxd index bfeecc43..d2401a42 100644 --- a/src/flint/types/acb_mat.pxd +++ b/src/flint/types/acb_mat.pxd @@ -1,6 +1,5 @@ from flint.flint_base.flint_base cimport flint_mat - -from flint._flint cimport acb_mat_t +from flint.flintlib.acb_mat cimport acb_mat_t cdef class acb_mat(flint_mat): cdef acb_mat_t val diff --git a/src/flint/types/acb_poly.pxd b/src/flint/types/acb_poly.pxd index f6aca1ad..eff7b2e3 100644 --- a/src/flint/types/acb_poly.pxd +++ b/src/flint/types/acb_poly.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_poly -from flint._flint cimport acb_poly_t +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): diff --git a/src/flint/types/acb_series.pxd b/src/flint/types/acb_series.pxd index ed5d22ce..66896994 100644 --- a/src/flint/types/acb_series.pxd +++ b/src/flint/types/acb_series.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_series -from flint._flint cimport acb_poly_t +from flint.flintlib.acb_poly cimport acb_poly_t cdef class acb_series(flint_series): cdef acb_poly_t val diff --git a/src/flint/types/acb_series.pyx b/src/flint/types/acb_series.pyx index 9407c516..5e369df9 100644 --- a/src/flint/types/acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -20,6 +20,7 @@ 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 * from flint._flint cimport * cimport cython diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index 7bb77e80..5800f2ba 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -20,6 +20,7 @@ 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 diff --git a/src/flint/types/dirichlet.pxd b/src/flint/types/dirichlet.pxd index c2a5d925..18988a7a 100644 --- a/src/flint/types/dirichlet.pxd +++ b/src/flint/types/dirichlet.pxd @@ -1,5 +1,5 @@ -from flint._flint cimport dirichlet_group_t -from flint._flint cimport dirichlet_char_t +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 diff --git a/src/flint/types/dirichlet.pyx b/src/flint/types/dirichlet.pyx index b479f43e..27b8a6a8 100644 --- a/src/flint/types/dirichlet.pyx +++ b/src/flint/types/dirichlet.pyx @@ -6,6 +6,8 @@ from flint.types.fmpz cimport fmpz from flint._flint cimport * 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 = {} diff --git a/src/flint/types/fmpz_mpoly.pxd b/src/flint/types/fmpz_mpoly.pxd index 5f5a134e..8cf863c3 100644 --- a/src/flint/types/fmpz_mpoly.pxd +++ b/src/flint/types/fmpz_mpoly.pxd @@ -1,7 +1,7 @@ from flint.flint_base.flint_base cimport flint_mpoly -from flint._flint cimport fmpz_mpoly_ctx_t -from flint._flint cimport fmpz_mpoly_t +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: diff --git a/src/flint/types/fmpz_mpoly.pyx b/src/flint/types/fmpz_mpoly.pyx index fe226f05..d51232b6 100644 --- a/src/flint/types/fmpz_mpoly.pyx +++ b/src/flint/types/fmpz_mpoly.pyx @@ -9,6 +9,7 @@ from flint.types.fmpz cimport fmpz from flint._flint cimport * cimport cython cimport libc.stdlib +from flint.flintlib.fmpz_mpoly cimport * cdef any_as_fmpz_mpoly(x): cdef fmpz_mpoly res diff --git a/src/flint/types/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx index a774f0bd..d9ac795c 100644 --- a/src/flint/types/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -29,6 +29,7 @@ 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 From 4a65ad54fb6e6a4fb2b0e900c3ff6ce02f41d2ec Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 6 Sep 2023 13:15:38 +0100 Subject: [PATCH 38/39] Don't import * from flint._flint in flint.types --- src/flint/_flint.pxd | 1 - src/flint/types/acb.pyx | 2 +- src/flint/types/acb_mat.pyx | 1 - src/flint/types/acb_poly.pyx | 2 +- src/flint/types/acb_series.pyx | 1 - src/flint/types/arb.pyx | 2 +- src/flint/types/arb_mat.pyx | 1 - src/flint/types/arb_poly.pyx | 1 - src/flint/types/arb_series.pyx | 1 - src/flint/types/arf.pyx | 1 - src/flint/types/dirichlet.pyx | 1 - src/flint/types/fmpq.pyx | 2 +- src/flint/types/fmpq_mat.pyx | 1 - src/flint/types/fmpq_poly.pyx | 1 - src/flint/types/fmpq_series.pyx | 1 - src/flint/types/fmpz.pyx | 2 +- src/flint/types/fmpz_mat.pyx | 1 - src/flint/types/fmpz_mpoly.pyx | 1 - src/flint/types/fmpz_poly.pyx | 1 - src/flint/types/fmpz_series.pyx | 1 - src/flint/types/nmod.pxd | 2 +- src/flint/types/nmod.pyx | 2 +- src/flint/types/nmod_mat.pyx | 2 +- src/flint/types/nmod_poly.pyx | 1 - 24 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 09ba307c..8806fb57 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -70,7 +70,6 @@ cdef extern from *: """ slong pylong_as_slong(PyObject *pylong, int *overflow) -from flint.flintlib.nmod_vec cimport nmod_t from flint.flintlib.nmod_poly cimport nmod_poly_t from flint.flintlib.nmod_mat cimport nmod_mat_t from flint.flintlib.fmpz cimport fmpz_t diff --git a/src/flint/types/acb.pyx b/src/flint/types/acb.pyx index afa12aea..d0d345eb 100644 --- a/src/flint/types/acb.pyx +++ b/src/flint/types/acb.pyx @@ -13,7 +13,7 @@ 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 * +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 * diff --git a/src/flint/types/acb_mat.pyx b/src/flint/types/acb_mat.pyx index ffba33d2..56e9db1d 100644 --- a/src/flint/types/acb_mat.pyx +++ b/src/flint/types/acb_mat.pyx @@ -13,7 +13,6 @@ 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._flint cimport * from flint.flintlib.mag cimport * from flint.flintlib.arb cimport * from flint.flintlib.arb_mat cimport * diff --git a/src/flint/types/acb_poly.pyx b/src/flint/types/acb_poly.pyx index 2368ac52..db9dc77b 100644 --- a/src/flint/types/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -12,9 +12,9 @@ from flint.types.fmpz cimport fmpz from flint.types.fmpq cimport fmpq from flint.types.arb cimport arb -from flint._flint cimport * 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 diff --git a/src/flint/types/acb_series.pyx b/src/flint/types/acb_series.pyx index 5e369df9..39b399da 100644 --- a/src/flint/types/acb_series.pyx +++ b/src/flint/types/acb_series.pyx @@ -22,7 +22,6 @@ from flint.flintlib.acb_modular cimport * from flint.flintlib.acb_hypgeom cimport * from flint.flintlib.acb_dirichlet cimport * -from flint._flint cimport * cimport cython cimport libc.stdlib diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index 5800f2ba..129a519a 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -14,7 +14,7 @@ from flint.types.arf cimport arf from flint.types.fmpq cimport fmpq from flint.types.fmpz cimport fmpz -from flint._flint cimport * +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 * diff --git a/src/flint/types/arb_mat.pyx b/src/flint/types/arb_mat.pyx index 86952266..c85b6eef 100644 --- a/src/flint/types/arb_mat.pyx +++ b/src/flint/types/arb_mat.pyx @@ -14,7 +14,6 @@ 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._flint cimport * from flint.flintlib.arf cimport * from flint.flintlib.arb cimport * from flint.flintlib.arb_mat cimport * diff --git a/src/flint/types/arb_poly.pyx b/src/flint/types/arb_poly.pyx index 7df1bd11..85ad978d 100644 --- a/src/flint/types/arb_poly.pyx +++ b/src/flint/types/arb_poly.pyx @@ -12,7 +12,6 @@ from flint.types.fmpq cimport fmpq from flint.types.acb cimport acb from flint.types.acb_poly cimport acb_poly -from flint._flint cimport * from flint.flintlib.arb cimport * from flint.flintlib.arb_poly cimport * cimport cython diff --git a/src/flint/types/arb_series.pyx b/src/flint/types/arb_series.pyx index 772c5ef0..46b1151c 100644 --- a/src/flint/types/arb_series.pyx +++ b/src/flint/types/arb_series.pyx @@ -15,7 +15,6 @@ from flint.types.acb cimport acb from flint.types.acb_poly cimport acb_poly from flint.types.acb_series cimport acb_series -from flint._flint cimport * from flint.flintlib.arb cimport * from flint.flintlib.arb_poly cimport * from flint.flintlib.arb_hypgeom cimport * diff --git a/src/flint/types/arf.pyx b/src/flint/types/arf.pyx index aafd237e..53d1ef30 100644 --- a/src/flint/types/arf.pyx +++ b/src/flint/types/arf.pyx @@ -7,7 +7,6 @@ from flint.types.fmpz cimport fmpz from flint.types.fmpz cimport any_as_fmpz from flint.types.arb cimport arb -from flint._flint cimport * from flint.flintlib.arf cimport * ctx = thectx diff --git a/src/flint/types/dirichlet.pyx b/src/flint/types/dirichlet.pyx index 27b8a6a8..613ca704 100644 --- a/src/flint/types/dirichlet.pyx +++ b/src/flint/types/dirichlet.pyx @@ -3,7 +3,6 @@ from flint.types.acb cimport any_as_acb from flint.types.acb cimport acb from flint.types.fmpz cimport fmpz -from flint._flint cimport * from flint.flintlib.ulong_extras cimport n_gcd from flint.flintlib.fmpz cimport fmpz_get_ui from flint.flintlib.dirichlet cimport * diff --git a/src/flint/types/fmpq.pyx b/src/flint/types/fmpq.pyx index d1fc4267..35f81a3d 100644 --- a/src/flint/types/fmpq.pyx +++ b/src/flint/types/fmpq.pyx @@ -4,7 +4,7 @@ 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 * +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 diff --git a/src/flint/types/fmpq_mat.pyx b/src/flint/types/fmpq_mat.pyx index 6ce3e893..bb322729 100644 --- a/src/flint/types/fmpq_mat.pyx +++ b/src/flint/types/fmpq_mat.pyx @@ -7,7 +7,6 @@ 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._flint cimport * 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 * diff --git a/src/flint/types/fmpq_poly.pyx b/src/flint/types/fmpq_poly.pyx index fec5c1fe..b485bd0a 100644 --- a/src/flint/types/fmpq_poly.pyx +++ b/src/flint/types/fmpq_poly.pyx @@ -8,7 +8,6 @@ from flint.types.fmpq cimport any_as_fmpq from flint.types.fmpz cimport fmpz from flint.types.fmpz cimport any_as_fmpz -from flint._flint cimport * from flint.flintlib.fmpz cimport fmpz_is_zero from flint.flintlib.fmpz cimport fmpz_set from flint.flintlib.fmpq cimport fmpq_is_zero diff --git a/src/flint/types/fmpq_series.pyx b/src/flint/types/fmpq_series.pyx index 270dda67..644fab5a 100644 --- a/src/flint/types/fmpq_series.pyx +++ b/src/flint/types/fmpq_series.pyx @@ -15,7 +15,6 @@ 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._flint cimport * from flint.flintlib.fmpz cimport fmpz_is_zero,fmpz_set,fmpz_equal from flint.flintlib.fmpq_poly cimport * diff --git a/src/flint/types/fmpz.pyx b/src/flint/types/fmpz.pyx index e44f0914..45f7b6f9 100644 --- a/src/flint/types/fmpz.pyx +++ b/src/flint/types/fmpz.pyx @@ -6,7 +6,7 @@ from flint.utils.conversion cimport chars_from_str from flint.utils.conversion cimport str_from_chars, _str_trunc cimport libc.stdlib -from flint._flint cimport * +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 * diff --git a/src/flint/types/fmpz_mat.pyx b/src/flint/types/fmpz_mat.pyx index 133568c5..121f2ce8 100644 --- a/src/flint/types/fmpz_mat.pyx +++ b/src/flint/types/fmpz_mat.pyx @@ -9,7 +9,6 @@ from flint.pyflint cimport global_random_state from flint.types.fmpq cimport any_as_fmpq cimport cython -from flint._flint cimport * 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 diff --git a/src/flint/types/fmpz_mpoly.pyx b/src/flint/types/fmpz_mpoly.pyx index d51232b6..1e179c9b 100644 --- a/src/flint/types/fmpz_mpoly.pyx +++ b/src/flint/types/fmpz_mpoly.pyx @@ -6,7 +6,6 @@ from flint.flint_base.flint_base cimport flint_mpoly from flint.types.fmpz cimport any_as_fmpz from flint.types.fmpz cimport fmpz -from flint._flint cimport * cimport cython cimport libc.stdlib from flint.flintlib.fmpz_mpoly cimport * diff --git a/src/flint/types/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx index d9ac795c..ba532a62 100644 --- a/src/flint/types/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -22,7 +22,6 @@ 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._flint cimport * from flint.flintlib.ulong_extras cimport n_is_prime from flint.flintlib.fmpz_poly cimport * from flint.flintlib.fmpz_poly_factor cimport * diff --git a/src/flint/types/fmpz_series.pyx b/src/flint/types/fmpz_series.pyx index d2473519..21549e54 100644 --- a/src/flint/types/fmpz_series.pyx +++ b/src/flint/types/fmpz_series.pyx @@ -14,7 +14,6 @@ from flint.types.acb cimport acb from flint.types.acb_poly cimport acb_poly from flint.types.acb_series cimport acb_series -from flint._flint cimport * from flint.flintlib.fmpz cimport fmpz_is_zero, fmpz_is_pm1 from flint.flintlib.fmpz_poly cimport * diff --git a/src/flint/types/nmod.pxd b/src/flint/types/nmod.pxd index 4ece832b..0a441fec 100644 --- a/src/flint/types/nmod.pxd +++ b/src/flint/types/nmod.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_scalar from flint._flint cimport mp_limb_t -from flint._flint cimport nmod_t +from flint.flintlib.nmod_vec cimport nmod_t cdef int any_as_nmod(mp_limb_t * val, obj, nmod_t mod) except -1 diff --git a/src/flint/types/nmod.pyx b/src/flint/types/nmod.pyx index 59045790..bf83f4da 100644 --- a/src/flint/types/nmod.pyx +++ b/src/flint/types/nmod.pyx @@ -5,7 +5,7 @@ from flint.types.fmpz cimport any_as_fmpz from flint.types.fmpz cimport fmpz from flint.types.fmpq cimport fmpq -from flint._flint cimport * +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 diff --git a/src/flint/types/nmod_mat.pyx b/src/flint/types/nmod_mat.pyx index 1419ad6e..6a813433 100644 --- a/src/flint/types/nmod_mat.pyx +++ b/src/flint/types/nmod_mat.pyx @@ -9,7 +9,7 @@ from flint.flint_base.flint_context cimport thectx cimport cython -from flint._flint cimport * +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 diff --git a/src/flint/types/nmod_poly.pyx b/src/flint/types/nmod_poly.pyx index 33dfd665..6128eca9 100644 --- a/src/flint/types/nmod_poly.pyx +++ b/src/flint/types/nmod_poly.pyx @@ -6,7 +6,6 @@ from flint.types.fmpz_poly cimport fmpz_poly from flint.types.nmod cimport any_as_nmod from flint.types.nmod cimport nmod -from flint._flint cimport * from flint.flintlib.nmod_vec cimport * from flint.flintlib.nmod_poly cimport * from flint.flintlib.fmpz_poly cimport fmpz_poly_get_nmod_poly From 8ad8919a410f23421c80d0d4e0bb0d2f0f493a7f Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 6 Sep 2023 14:32:05 +0100 Subject: [PATCH 39/39] Import from flint.flintlib instead of flint._flint --- src/flint/_flint.pxd | 24 ------------------------ src/flint/flint_base/flint_context.pxd | 2 +- src/flint/pyflint.pxd | 2 +- src/flint/types/acb.pxd | 2 +- src/flint/types/arb.pxd | 2 +- src/flint/types/arb_mat.pxd | 2 +- src/flint/types/arb_poly.pxd | 2 +- src/flint/types/arb_series.pxd | 2 +- src/flint/types/arf.pxd | 2 +- src/flint/types/fmpq.pxd | 2 +- src/flint/types/fmpq_mat.pxd | 2 +- src/flint/types/fmpq_poly.pxd | 2 +- src/flint/types/fmpq_series.pxd | 2 +- src/flint/types/fmpz.pxd | 4 ++-- src/flint/types/fmpz_mat.pxd | 2 +- src/flint/types/fmpz_poly.pxd | 2 +- src/flint/types/fmpz_series.pxd | 2 +- src/flint/types/nmod_mat.pxd | 2 +- src/flint/types/nmod_poly.pxd | 2 +- 19 files changed, 19 insertions(+), 43 deletions(-) diff --git a/src/flint/_flint.pxd b/src/flint/_flint.pxd index 8806fb57..c0218e25 100644 --- a/src/flint/_flint.pxd +++ b/src/flint/_flint.pxd @@ -70,30 +70,6 @@ cdef extern from *: """ slong pylong_as_slong(PyObject *pylong, int *overflow) -from flint.flintlib.nmod_poly cimport nmod_poly_t -from flint.flintlib.nmod_mat cimport nmod_mat_t -from flint.flintlib.fmpz cimport fmpz_t -from flint.flintlib.fmpz_poly cimport fmpz_poly_t, fmpz_poly_struct -from flint.flintlib.fmpz_mat cimport fmpz_mat_struct, fmpz_mat_t -from flint.flintlib.fmpq cimport fmpq_t, fmpq_struct -from flint.flintlib.fmpq_poly cimport fmpq_poly_struct, fmpq_poly_t -from flint.flintlib.fmpq_mat cimport fmpq_mat_t -from flint.flintlib.mag cimport mag_struct, mag_t, mag_ptr, mag_srcptr - -from flint.flintlib.arf cimport arf_struct, arf_t, arf_ptr, arf_srcptr, arf_rnd_t -from flint.flintlib.arb cimport arb_struct, arb_ptr, arb_srcptr, arb_t -from flint.flintlib.arb cimport arb_midref, arb_radref -from flint.flintlib.acb cimport acb_struct, acb_ptr, acb_srcptr, acb_t -from flint.flintlib.acb cimport acb_realref, acb_imagref -from flint.flintlib.arb_poly cimport arb_poly_struct, arb_poly_t -from flint.flintlib.arb_mat cimport arb_mat_struct, arb_mat_t -# from flint.flintlib.acb_poly cimport acb_poly_struct, acb_poly_t -# from flint.flintlib.acb_mat cimport acb_mat_struct, acb_mat_t -# from flint.flintlib.dirichlet cimport dirichlet_group_struct, dirichlet_group_t -# from flint.flintlib.dirichlet cimport dirichlet_char_struct, dirichlet_char_t -# from flint.flintlib.mpoly cimport ordering_t, mpoly_ctx_struct, mpoly_ctx_t - - """ 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/pyflint.pxd b/src/flint/pyflint.pxd index 53a09575..d34fb964 100644 --- a/src/flint/pyflint.pxd +++ b/src/flint/pyflint.pxd @@ -1,4 +1,4 @@ -from flint._flint cimport * +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 diff --git a/src/flint/types/acb.pxd b/src/flint/types/acb.pxd index e8ba4faf..5c2781f5 100644 --- a/src/flint/types/acb.pxd +++ b/src/flint/types/acb.pxd @@ -1,5 +1,5 @@ from flint.flint_base.flint_base cimport flint_scalar -from flint._flint cimport acb_t +from flint.flintlib.acb cimport acb_t cdef any_as_acb(x) cdef any_as_acb_or_notimplemented(x) diff --git a/src/flint/types/arb.pxd b/src/flint/types/arb.pxd index ec18a499..fbe1447e 100644 --- a/src/flint/types/arb.pxd +++ b/src/flint/types/arb.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_scalar -from flint._flint cimport arb_t +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 diff --git a/src/flint/types/arb_mat.pxd b/src/flint/types/arb_mat.pxd index 6446a85f..b7c578c7 100644 --- a/src/flint/types/arb_mat.pxd +++ b/src/flint/types/arb_mat.pxd @@ -1,5 +1,5 @@ from flint.flint_base.flint_base cimport flint_mat -from flint._flint cimport arb_mat_t +from flint.flintlib.arb_mat cimport arb_mat_t cdef class arb_mat(flint_mat): cdef arb_mat_t val diff --git a/src/flint/types/arb_poly.pxd b/src/flint/types/arb_poly.pxd index 072b5ac6..536e39dc 100644 --- a/src/flint/types/arb_poly.pxd +++ b/src/flint/types/arb_poly.pxd @@ -1,5 +1,5 @@ from flint.flint_base.flint_base cimport flint_poly -from flint._flint cimport arb_poly_t +from flint.flintlib.arb_poly cimport arb_poly_t cdef arb_poly_set_list(arb_poly_t poly, list val, long prec) diff --git a/src/flint/types/arb_series.pxd b/src/flint/types/arb_series.pxd index 2506550d..efbd35ad 100644 --- a/src/flint/types/arb_series.pxd +++ b/src/flint/types/arb_series.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_series -from flint._flint cimport arb_poly_t +from flint.flintlib.arb_poly cimport arb_poly_t cdef class arb_series(flint_series): cdef arb_poly_t val diff --git a/src/flint/types/arf.pxd b/src/flint/types/arf.pxd index 4ef65d9c..1784585b 100644 --- a/src/flint/types/arf.pxd +++ b/src/flint/types/arf.pxd @@ -1,4 +1,4 @@ -from flint._flint cimport arf_t +from flint.flintlib.arf cimport arf_t cdef class arf: cdef arf_t val diff --git a/src/flint/types/fmpq.pxd b/src/flint/types/fmpq.pxd index 92e899ff..3ef00f3c 100644 --- a/src/flint/types/fmpq.pxd +++ b/src/flint/types/fmpq.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_scalar -from flint._flint cimport fmpq_t +from flint.flintlib.fmpq cimport fmpq_t cdef any_as_fmpq(obj) cdef class fmpq(flint_scalar): diff --git a/src/flint/types/fmpq_mat.pxd b/src/flint/types/fmpq_mat.pxd index 6713516d..702002f8 100644 --- a/src/flint/types/fmpq_mat.pxd +++ b/src/flint/types/fmpq_mat.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_mat -from flint._flint cimport fmpq_mat_t +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 diff --git a/src/flint/types/fmpq_poly.pxd b/src/flint/types/fmpq_poly.pxd index a83a45d9..2353cded 100644 --- a/src/flint/types/fmpq_poly.pxd +++ b/src/flint/types/fmpq_poly.pxd @@ -1,5 +1,5 @@ from flint.flint_base.flint_base cimport flint_poly -from flint._flint cimport fmpq_poly_t +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) diff --git a/src/flint/types/fmpq_series.pxd b/src/flint/types/fmpq_series.pxd index 7aa92929..968791b8 100644 --- a/src/flint/types/fmpq_series.pxd +++ b/src/flint/types/fmpq_series.pxd @@ -1,5 +1,5 @@ from flint.flint_base.flint_base cimport flint_series -from flint._flint cimport fmpq_poly_t +from flint.flintlib.fmpq_poly cimport fmpq_poly_t cdef class fmpq_series(flint_series): cdef fmpq_poly_t val diff --git a/src/flint/types/fmpz.pxd b/src/flint/types/fmpz.pxd index bf800df9..d23f5f71 100644 --- a/src/flint/types/fmpz.pxd +++ b/src/flint/types/fmpz.pxd @@ -3,9 +3,9 @@ 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 fmpz_t, slong, pylong_as_slong +from flint._flint cimport slong, pylong_as_slong from flint._flint cimport PyObject -from flint.flintlib.fmpz cimport fmpz_set_str, fmpz_set_si +from flint.flintlib.fmpz cimport fmpz_t, fmpz_set_str, fmpz_set_si from cpython.version cimport PY_MAJOR_VERSION diff --git a/src/flint/types/fmpz_mat.pxd b/src/flint/types/fmpz_mat.pxd index b4554858..ae482653 100644 --- a/src/flint/types/fmpz_mat.pxd +++ b/src/flint/types/fmpz_mat.pxd @@ -1,5 +1,5 @@ from flint.flint_base.flint_base cimport flint_mat -from flint._flint cimport fmpz_mat_t +from flint.flintlib.fmpz_mat cimport fmpz_mat_t from flint.types.fmpz cimport fmpz cdef any_as_fmpz_mat(obj) diff --git a/src/flint/types/fmpz_poly.pxd b/src/flint/types/fmpz_poly.pxd index a58e39d4..61bc109d 100644 --- a/src/flint/types/fmpz_poly.pxd +++ b/src/flint/types/fmpz_poly.pxd @@ -1,7 +1,7 @@ from flint.flint_base.flint_base cimport flint_poly -from flint._flint cimport fmpz_poly_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t cdef fmpz_poly_set_list(fmpz_poly_t poly, list val) diff --git a/src/flint/types/fmpz_series.pxd b/src/flint/types/fmpz_series.pxd index 7a5df67d..3c476a28 100644 --- a/src/flint/types/fmpz_series.pxd +++ b/src/flint/types/fmpz_series.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_series -from flint._flint cimport fmpz_poly_t +from flint.flintlib.fmpz_poly cimport fmpz_poly_t cdef class fmpz_series(flint_series): cdef fmpz_poly_t val diff --git a/src/flint/types/nmod_mat.pxd b/src/flint/types/nmod_mat.pxd index d7c0e1c1..7a31e15b 100644 --- a/src/flint/types/nmod_mat.pxd +++ b/src/flint/types/nmod_mat.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_mat -from flint._flint cimport nmod_mat_t +from flint.flintlib.nmod_mat cimport nmod_mat_t from flint._flint cimport mp_limb_t cdef class nmod_mat: diff --git a/src/flint/types/nmod_poly.pxd b/src/flint/types/nmod_poly.pxd index 1bf91747..ab33f64c 100644 --- a/src/flint/types/nmod_poly.pxd +++ b/src/flint/types/nmod_poly.pxd @@ -1,6 +1,6 @@ from flint.flint_base.flint_base cimport flint_poly -from flint._flint cimport nmod_poly_t +from flint.flintlib.nmod_poly cimport nmod_poly_t from flint._flint cimport mp_limb_t cdef class nmod_poly(flint_poly):