Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate all flintlib .pxd files #217

Merged
merged 15 commits into from
Sep 5, 2024

Conversation

oscarbenjamin
Copy link
Collaborator

Follows gh-215

@oscarbenjamin
Copy link
Collaborator Author

I have separated the flintlib .pxd files into two subdirectories:

  1. flint.flintlib.types contains all structs and typedefs and is all hand-written code.
  2. flint.flintlib.functions contains all the functions and is generated by scraping the docs.

This means that you do e.g.:

from flint.flintlib.types cimport fmpz_t
from flint.flintlib.function cimport fmpz_is_one

We also need to add macros and some undocumented functions into the hand-written code. Possibly it would be better to change the doc-scraping script so that it has a hard-coded list of macros to recognise and declare as functions. The undocumented functions should be fixed upstream.

Some of the .pxd files in functions still need to be rearranged: remove the struct definitions and place in a new .pxd in the types directory. Then they can be auto-generated as well.

About half of modules used in python-flint are now auto-generated by a single script:

$ bin/all_rst_to_pxd.sh ../flint/doc/source/
Processing acb_calc
Processing acb_dft
Processing acb_dirichlet
Processing acb_elliptic
Processing acb_hypgeom
Processing acb_mat
Processing acb_modular
Processing acb_poly
Processing acb
Processing acb_theta
Processing arb_fmpz_poly
Processing arb_hypgeom
Processing arb_mat
Processing arb_poly
Processing arb
Processing arf
Processing arith
Processing bernoulli
Processing dirichlet
Processing fmpz_factor
Processing fmpz_lll
Processing fmpz_mat
Processing fmpz_poly_factor
Processing fmpz_poly
Processing fmpz
Processing fmpz_vec
Processing mag
Processing partitions
Processing ulong_extras

Status is:

modules=(
"acb_calc"
"acb_dft"
"acb_dirichlet"
"acb_elliptic"
"acb_hypgeom"
"acb_mat"
"acb_modular"
"acb_poly"
"acb"
"acb_theta"
"arb_fmpz_poly"
"arb_hypgeom"
"arb_mat"
"arb_poly"
"arb"
"arf"
"arith"
"bernoulli"
"dirichlet"
#"fmpq_mat"
#"fmpq_mpoly_factor"
#"fmpq_mpoly"
#"fmpq_poly"
#"fmpq"
#"fmpq_vec"
"fmpz_factor"
"fmpz_lll"
"fmpz_mat"
#"fmpz_mod_mat"
#"fmpz_mod_mpoly_factor"
#"fmpz_mod_mpoly"
#"fmpz_mod_poly_factor"
#"fmpz_mod_poly"
#"fmpz_mod"
#"fmpz_mod_vec"
#"fmpz_mpoly_factor"
#"fmpz_mpoly"
#"fmpz_mpoly_q"
"fmpz_poly_factor"
"fmpz_poly"
"fmpz"
"fmpz_vec"
#"fq_default_mat"
#"fq_default_poly_factor"
#"fq_default_poly"
#"fq_default"
#"fq_mat"
#"fq_nmod_mat"
#"fq_nmod_poly_factor"
#"fq_nmod_poly"
#"fq_nmod"
#"fq_poly_factor"
#"fq_poly"
#"fq"
#"fq_zech_mat"
#"fq_zech_poly_factor"
#"fq_zech_poly"
#"fq_zech"
"mag"
#"mpoly"
#"nmod_mat"
#"nmod_mpoly_factor"
#"nmod_mpoly"
#"nmod_poly_factor"
#"nmod_poly"
#"nmod"
#"nmod_vec"
"partitions"
"ulong_extras"
)

@oscarbenjamin
Copy link
Collaborator Author

The diff here is now large because all of the flintlib.pxd files have been moved. I'm going to merge this shortly to get it in before merge conflicts arise.

@oscarbenjamin
Copy link
Collaborator Author

Okay, I've made it so that all the .pxd files in flintlib.functions are generated automatically. That applies to all of the FLINT modules that are actually used in python-flint. I made a full list of all FLINT modules here so you can see which are being used and easily uncomment the others when needed:

modules=(
# "flint"
"mpoly"
# "thread_pool"
# "machine_vectors"
# "gr"
# "gr_domains"
# "gr_generic"
# "gr_implementing"
# "gr_mat"
# "gr_mpoly"
# "gr_poly"
# "gr_special"
# "gr_vec"
"ulong_extras"
"fmpz"
# "fmpz_extras"
"fmpz_factor"
"fmpz_lll"
"fmpz_mat"
"fmpz_mpoly"
"fmpz_mpoly_factor"
"fmpz_mpoly_q"
"fmpz_poly"
"fmpz_poly_factor"
# "fmpz_poly_mat"
# "fmpz_poly_q"
"fmpz_vec"
# "long_extras"
# "longlong"
# "mpn_extras"
# "aprcl"
"arith"
# "fft"
# "fft_small"
# "qsieve"
"fmpq"
"fmpq_mat"
"fmpq_mpoly"
"fmpq_mpoly_factor"
"fmpq_poly"
"fmpq_vec"
"nmod"
"nmod_mat"
"nmod_mpoly"
"nmod_mpoly_factor"
"nmod_poly"
"nmod_poly_factor"
# "nmod_poly_mat"
"nmod_vec"
# "mpn_mod"
"fmpz_mod"
"fmpz_mod_mat"
"fmpz_mod_mpoly"
"fmpz_mod_mpoly_factor"
"fmpz_mod_poly"
"fmpz_mod_poly_factor"
"fmpz_mod_vec"
"dirichlet"
# "dlog"
# "bool_mat"
# "perm"
# "qfb"
# "nf"
# "nf_elem"
# "fmpzi"
# "qqbar"
"mag"
# "nfloat"
"arf"
# "acf"
"arb"
# "arb_calc"
"arb_fmpz_poly"
# "arb_fpwrap"
"arb_hypgeom"
"arb_mat"
"arb_poly"
"acb"
"acb_calc"
"acb_dft"
"acb_dirichlet"
"acb_elliptic"
"acb_hypgeom"
"acb_mat"
"acb_modular"
"acb_poly"
"acb_theta"
"bernoulli"
# "hypgeom"
"partitions"
# "ca"
# "ca_ext"
# "ca_field"
# "ca_mat"
# "ca_poly"
# "ca_vec"
# "calcium"
# "fexpr"
# "fexpr_builtin"
"fq"
# "fq_embed"
"fq_mat"
"fq_poly"
"fq_poly_factor"
# "fq_vec"
"fq_nmod"
# "fq_nmod_embed"
"fq_nmod_mat"
# "fq_nmod_mpoly"
# "fq_nmod_mpoly_factor"
"fq_nmod_poly"
"fq_nmod_poly_factor"
# "fq_nmod_vec"
"fq_zech"
# "fq_zech_embed"
"fq_zech_mat"
"fq_zech_poly"
"fq_zech_poly_factor"
# "fq_zech_vec"
"fq_default"
"fq_default_mat"
"fq_default_poly"
"fq_default_poly_factor"
# "padic"
# "padic_mat"
# "padic_poly"
# "qadic"
# "double_extras"
# "double_interval"
# "d_mat"
# "d_vec"
# "mpfr_mat"
# "mpfr_vec"

@oscarbenjamin oscarbenjamin merged commit d4a8f7c into flintlib:main Sep 5, 2024
40 checks passed
@oscarbenjamin oscarbenjamin deleted the pr_pxd_files branch September 5, 2024 19:02
@oscarbenjamin oscarbenjamin changed the title Autogenerate all acb_* .pxd files Autogenerate all flintlib .pxd files Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant