Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
357e435
Make it work with flint 3.0
deinst Aug 11, 2023
e973105
Change from distutils to setuptools
deinst Aug 11, 2023
74c5f85
Change include paths for flint 3.0
deinst Aug 16, 2023
c24b2ff
Starting attack at fmpz_mpoly
deinst Aug 17, 2023
0489152
Made the tests pass.
deinst Aug 17, 2023
518c0a7
Merge remote-tracking branch 'upstream/master' into fmpz_mpoly
deinst Aug 17, 2023
89d567c
Back out changes for flint3 and setuptools
deinst Aug 17, 2023
7176fe7
add prototype for fmpz_mpoly_sort_terms.
deinst Aug 18, 2023
3dbc6ae
Moved generic pieces of fmpz_mpoly_context to base class.
deinst Aug 18, 2023
dc7be11
doctests for fmpz_mpoly_context object
deinst Aug 19, 2023
b5d0e91
Merge branch 'master' into fmpz_mpoly
deinst Aug 21, 2023
843b9f3
Added ability to construct an fmpz_mpoly from a dictionary.
deinst Aug 23, 2023
f346904
Added create_fmpz_mpoly to remove blocks of redundant code.
deinst Aug 25, 2023
3407bce
Initial steps towards fmpz_mpoly.
deinst Aug 28, 2023
96178ce
Merge branch 'master' into fmpz_mpoly
deinst Sep 9, 2023
0f2fceb
Small advances in fmpz_mpoly.
deinst Sep 12, 2023
fe614c5
Merge branch 'master' into fmpz_mpoly
deinst Sep 14, 2023
fbe31b7
Added fmpz_mpoly_factor and fmpq_mpoly.
deinst Sep 22, 2023
7f9c193
Added fmpq_mpoly to setup.py
deinst Sep 22, 2023
70b23be
Merge branch 'master' into fmpz_mpoly
deinst Sep 22, 2023
692c3e7
Merge branch 'master' into fmpz_mpoly
deinst Sep 23, 2023
ab7e114
Added factoring to fmpq_mpoly
deinst Sep 24, 2023
2ebf15d
Framing of fmpz_mpoly_q laid out.
deinst Sep 24, 2023
ca4391d
Fixed small bugs in fmpz_mpoly and fmpq_mpoly
deinst Sep 24, 2023
b156482
Merge branch 'master' into fmpz_mpoly
deinst Sep 28, 2023
1313637
Added printing of fmpz_mpoly_q
deinst Sep 30, 2023
5249c19
Merge branch 'master' into fmpz_mpoly
deinst Sep 30, 2023
80b1325
Added operations on fmpz_mpoly that return fmpq_mpoly of fmpz_mpoly_q
deinst Oct 9, 2023
e3c81d8
Added tests, checks for division by zero to fmpz_mpoly
deinst Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires=["setuptools", "cython", "wheel"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seem to be various unrelated changes bundled in here. This one is possibly what breaks building the wheels in CI.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to keep different changes like this in separate pull requests so this one can be for adding fmpz_mpoly but changes for flint 3 would go somewhere else (actually we already have a gh-43 for that).

Any changes to the build system should definitely be kept separate from anything else so that we can see clearly the impact of each change independently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info on a coefficient/exponent dict.
Sorry about the build system confusion (I forgot that I did that I'll see about backing it out)
I agree about a common base class (one exists, but it is currently empty)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are actually three unrelated changes, include changes for flint 3.0, build system changes, and fmpz_changes. Sorry, I'll get to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've backed out the flint-3 and setuptools and will see if that makes the CI happy. I am building a copy of flint-2.9 so I can test it. What is the version of arb that corresponds to flint-2.9?

19 changes: 5 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import os
from subprocess import check_call

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
from setuptools import setup
from setuptools import Extension
from Cython.Build import cythonize
from numpy.distutils.system_info import default_include_dirs, default_lib_dirs

Expand All @@ -29,22 +28,15 @@
elif os.getenv('PYTHON_FLINT_MINGW64_TMP'):
# This would be used to build under Windows against these libraries if
# they have been installed somewhere other than .local
libraries = ["arb", "flint", "mpfr", "gmp"]
libraries = ["flint", "mpfr", "gmp"]
else:
# For the MSVC toolchain link with mpir instead of gmp
libraries = ["arb", "flint", "mpir", "mpfr", "pthreads"]
libraries = ["flint", "mpir", "mpfr", "pthreads"]
else:
# On Ubuntu libarb.so is called libflint-arb.so
if os.getenv('PYTHON_FLINT_LIBFLINT_ARB'):
arb = 'flint-arb'
else:
arb = 'arb'

libraries = [arb, "flint"]
libraries = ["flint"]
(opt,) = get_config_vars('OPT')
os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes')


default_include_dirs += [
os.path.join(d, "flint") for d in default_include_dirs
]
Expand Down Expand Up @@ -78,7 +70,6 @@

setup(
name='python-flint',
cmdclass={'build_ext': build_ext},
ext_modules=cythonize(ext_modules, compiler_directives=compiler_directives),
#ext_modules=cythonize(ext_modules, compiler_directives=compiler_directives, annotate=True),
packages=['flint', 'flint.test'],
Expand Down
56 changes: 30 additions & 26 deletions src/flint/_flint.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ cdef extern from "flint/nmod_poly.h":
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)
Expand Down Expand Up @@ -156,6 +149,15 @@ cdef extern from "flint/nmod_poly.h":
void nmod_poly_exp_series(nmod_poly_t f, nmod_poly_t h, long n)

int nmod_poly_is_irreducible(nmod_poly_t f)

cdef extern from "flint/nmod_poly_factor.h":
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]

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)
Expand Down Expand Up @@ -753,7 +755,7 @@ cdef extern from "flint/arith.h":
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":
cdef extern from "flint/mag.h":
ctypedef struct mag_struct:
fmpz_struct exp
mp_limb_t man
Expand All @@ -768,7 +770,7 @@ cdef extern from "mag.h":
void mag_set_ui_2exp_si(mag_t x, ulong v, long e)
void mag_hypot(mag_t x, const mag_t y, const mag_t z)

cdef extern from "arf.h":
cdef extern from "flint/arf.h":
ctypedef struct arf_struct:
fmpz_struct exp
long size
Expand Down Expand Up @@ -902,7 +904,7 @@ cdef extern from "arf.h":
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":
cdef extern from "flint/arb.h":
ctypedef struct arb_struct:
arf_struct mid
mag_struct rad
Expand Down Expand Up @@ -1193,7 +1195,7 @@ cdef extern from "arb.h":
cdef ulong ARB_STR_CONDENSE
char * arb_get_str(const arb_t x, long n, ulong flags)

cdef extern from "acb.h":
cdef extern from "flint/acb.h":
ctypedef struct acb_struct:
arb_struct real
arb_struct imag
Expand Down Expand Up @@ -1384,15 +1386,15 @@ cdef extern from "acb.h":

void acb_root_ui(acb_t z, const acb_t x, ulong k, long prec)

cdef extern from "partitions.h":
cdef extern from "flint/partitions.h":
void partitions_fmpz_fmpz(fmpz_t, const fmpz_t, int)

cdef extern from "bernoulli.h":
cdef extern from "flint/bernoulli.h":
void bernoulli_fmpq_ui(fmpq_t, ulong)
void bernoulli_cache_compute(long n)


cdef extern from "arb_poly.h":
cdef extern from "flint/arb_poly.h":
ctypedef struct arb_poly_struct:
arb_ptr coeffs
long length
Expand Down Expand Up @@ -1600,7 +1602,7 @@ cdef extern from "arb_poly.h":

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":
cdef extern from "flint/arb_mat.h":
ctypedef struct arb_mat_struct:
arb_ptr entries
long r
Expand Down Expand Up @@ -1681,7 +1683,7 @@ cdef extern from "arb_mat.h":

int arb_mat_approx_solve(arb_mat_t X, const arb_mat_t A, const arb_mat_t B, long prec)

cdef extern from "acb_poly.h":
cdef extern from "flint/acb_poly.h":
ctypedef struct acb_poly_struct:
acb_ptr coeffs
long length
Expand Down Expand Up @@ -1886,7 +1888,7 @@ cdef extern from "acb_poly.h":

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":
cdef extern from "flint/acb_mat.h":
ctypedef struct acb_mat_struct:
acb_ptr entries
long r
Expand Down Expand Up @@ -1976,7 +1978,7 @@ cdef extern from "acb_mat.h":
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":
cdef extern from "flint/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)
Expand All @@ -1992,7 +1994,7 @@ cdef extern from "acb_modular.h":
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":
cdef extern from "flint/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)
Expand Down Expand Up @@ -2070,7 +2072,7 @@ cdef extern from "acb_hypgeom.h":
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":
cdef extern from "flint/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)
Expand Down Expand Up @@ -2135,7 +2137,7 @@ cdef extern from "arb_hypgeom.h":

void arb_hypgeom_legendre_p_ui_root(arb_t res, arb_t weight, ulong n, ulong k, long prec)

cdef extern from "dirichlet.h":
cdef extern from "flint/dirichlet.h":
ctypedef struct dirichlet_group_struct:
ulong q
ulong q_even
Expand Down Expand Up @@ -2194,7 +2196,7 @@ cdef extern from "dirichlet.h":
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":
cdef extern from "flint/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)

Expand All @@ -2211,7 +2213,7 @@ cdef extern from "acb_dirichlet.h":
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":
cdef extern from "flint/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)
Expand All @@ -2226,7 +2228,7 @@ cdef extern from "acb_elliptic.h":
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":
cdef extern from "flint/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:
Expand All @@ -2246,14 +2248,14 @@ cdef extern from "acb_calc.h":
const acb_calc_integrate_opt_t options,
long prec)

cdef extern from "arb_fmpz_poly.h":
cdef extern from "flint/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":
cdef extern from "flint/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)

Expand Down Expand Up @@ -2395,6 +2397,8 @@ cdef extern from "flint/fmpz_mpoly.h":
void fmpz_mpoly_get_term_monomial(fmpz_mpoly_t M, const fmpz_mpoly_t A,
slong i, const fmpz_mpoly_ctx_t ctx)

void fmpz_mpoly_sort_terms(fmpz_mpoly_t A, 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)
Expand Down
Loading