Skip to content

Commit bbc459f

Browse files
Merge pull request #218 from oscarbenjamin/pr_generic_rings
Initial bindings for generic rings
2 parents ae4fe25 + 90059f9 commit bbc459f

23 files changed

+4499
-13
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Contributors (0.7.0):
164164
- Giacomo Pope (GP)
165165
- Joris Roos (JR)
166166
- Edgar Costa (EC)
167+
- Frédéric Chapoton (FC)
167168
- Oscar Benjamin (OB)
168169

169170
Highlights (0.7.0):
@@ -175,18 +176,34 @@ Highlights (0.7.0):
175176
- [gh-132](https://github.com/flintlib/python-flint/pull/132),
176177
[gh-164](https://github.com/flintlib/python-flint/pull/164),
177178
[gh-190](https://github.com/flintlib/python-flint/pull/190),
179+
[gh-191](https://github.com/flintlib/python-flint/pull/191):
178180
[gh-192](https://github.com/flintlib/python-flint/pull/192):
181+
[gh-216](https://github.com/flintlib/python-flint/pull/216):
182+
[gh-225](https://github.com/flintlib/python-flint/pull/225):
179183
Add `fmpz_mpoly`, `fmpq_mpoly`, `nmod_poly` and `fmpz_mod_poly`
180184
types for multivariate polynomials with integer, rational or
181-
integers mod n coefficients. (JM)
185+
integers mod `n` coefficients. (JM)
182186
- [gh-142](https://github.com/flintlib/python-flint/pull/142)
183187
Add `acb_theta` module for the numerical evaluation of [theta
184188
functions](https://flintlib.org/doc/acb_theta.html) (only
185189
available for `Flint >= 3.1`). (EC)
190+
- [gh-218](https://github.com/flintlib/python-flint/pull/218)
191+
An experimental interface for FLINT's generic rings has been
192+
added. This provides access to many of FLINT's types that
193+
are not yet wrapped by python-flint such as Gaussian integer,
194+
number fields, qqbar, calcium, as well as both univariate and
195+
multivariate polynomials and series over these rings (no
196+
matrices yet though). (OB)
186197
- [gh-129](https://github.com/flintlib/python-flint/pull/129)
198+
[gh-208](https://github.com/flintlib/python-flint/pull/208)
187199
Use meson/meson-python instead of setuptools as the build system
188200
for parallel builds and better detection of build and dependency
189201
requirements. (OB)
202+
- [gh-201](https://github.com/flintlib/python-flint/pull/201)
203+
[gh-202](https://github.com/flintlib/python-flint/pull/202)
204+
The documentation has been updated and is now at
205+
[readthedocs](https://python-flint.readthedocs.io/en/latest/).
206+
(OB)
190207

191208
Compatibility break (0.7.0):
192209

@@ -198,11 +215,23 @@ Compatibility break (0.7.0):
198215

199216
Other changes (0.7.0):
200217

218+
- [gh-215](https://github.com/flintlib/python-flint/pull/215)
219+
[gh-219](https://github.com/flintlib/python-flint/pull/219)
220+
The FLINT binding declarations are now fully generated
221+
automatically from the FLINT docs. (OB)
222+
- [gh-203](https://github.com/flintlib/python-flint/pull/203)
223+
[gh-204](https://github.com/flintlib/python-flint/pull/204)
224+
[gh-205](https://github.com/flintlib/python-flint/pull/205)
225+
[gh-206](https://github.com/flintlib/python-flint/pull/206)
226+
[gh-207](https://github.com/flintlib/python-flint/pull/207)
227+
[gh-211](https://github.com/flintlib/python-flint/pull/211)
228+
[gh-212](https://github.com/flintlib/python-flint/pull/212)
229+
Various linting fixes and codebase improvements (FC and GP).
201230
- [gh-189](https://github.com/flintlib/python-flint/pull/189)
202231
All scalar and poly types now have `sqrt`. All poly types now
203232
have `factor_squarefree` and `leading_coefficient` methods.
204233
Exception types raised in a number of places were changed to
205-
`DomainError` for better consistency.
234+
`DomainError` for better consistency. (OB)
206235
- [gh-196](https://github.com/flintlib/python-flint/pull/196)
207236
Supported Python versions are 3.10-3.13 (3.9 dropped). CI
208237
Testing added for 3.13 free-threaded CPython.

bin/all_rst_to_pxd.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ modules=(
1515
"mpoly"
1616
# "thread_pool"
1717
# "machine_vectors"
18-
# "gr"
19-
# "gr_domains"
20-
# "gr_generic"
21-
# "gr_implementing"
22-
# "gr_mat"
23-
# "gr_mpoly"
24-
# "gr_poly"
25-
# "gr_special"
26-
# "gr_vec"
18+
"gr"
19+
"gr_domains"
20+
"gr_generic"
21+
"gr_implementing"
22+
"gr_mat"
23+
"gr_mpoly"
24+
"gr_poly"
25+
"gr_special"
26+
"gr_vec"
2727
"ulong_extras"
2828
"fmpz"
2929
# "fmpz_extras"

bin/rst_to_pxd.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
c_types = set(["void", "char", "short", "long", "int", "float", "double"])
5353
type_modifers = re.compile(r"\*|(\bconst\b)|(\bunsigned\b)|(\bsigned\b)")
5454
import_dict = {}
55+
# gr_domains.rst lists functions that are in gr.h
56+
doc_to_header = {'flint/gr_domains': 'flint/gr'}
57+
5558

5659
def get_cython_struct_types(file):
5760
"""
@@ -144,6 +147,9 @@ def get_all_types(function_list):
144147

145148

146149
def has_types(line, types):
150+
#ts = set(t for t in get_parameter_types(line) if t in types)
151+
#if ts:
152+
# print(ts, file=sys.stderr)
147153
return any(t in types for t in get_parameter_types(line))
148154

149155

@@ -171,7 +177,9 @@ def generate_pxd_file(h_name, opts):
171177
fill_import_dict(opts.flint_lib_dir)
172178
l=[]
173179
docdir = opts.arb_doc_dir
174-
name = h_name
180+
name = h_name
181+
h_name = doc_to_header.get(h_name, h_name)
182+
175183
if name[:6] == "flint/":
176184
docdir = opts.flint_doc_dir
177185
name = name[6:]

doc/source/_gr.rst

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
**_gr** -- generic rings (unstable interface)
2+
===============================================================================
3+
4+
.. note::
5+
This module provides a preliminary experimental interface for FLINT's
6+
generic rings. This is largely untested and the interface should be
7+
considered unstable. In future the generic rings code will be integrated
8+
with the rest of python-flint and this module may be removed. For now it
9+
provides access to many FLINT types that are not wrapped yet in the rest of
10+
python-flint.
11+
12+
The generic rings module provides access to the generic rings interface in
13+
FLINT. Usage of this interface consists of creating a context object to
14+
represent a particular domain and then using that context object to create
15+
elements of that domain. For example to create a context for polynomials in two
16+
variables over the Gaussian integers :math:`\mathbb{Z}[i][x,y]` we would do::
17+
18+
>>> from flint.types._gr import gr_fmpzi_ctx, gr_gr_mpoly_ctx
19+
>>> ctx = gr_gr_mpoly_ctx.new(gr_fmpzi_ctx, ["x", "y"])
20+
>>> ctx.gens()
21+
[x, y]
22+
>>> ctx.gens_recursive()
23+
[I, x, y]
24+
>>> I, x, y = ctx.gens_recursive()
25+
>>> p = (x + y + I)**2
26+
>>> p
27+
x^2 + 2*x*y + (2*I)*x + y^2 + (2*I)*y - 1
28+
29+
Some domains such as ``gr_fmpzi_ctx`` are global and do not need to be created.
30+
Others such as ``gr_gr_mpoly_ctx`` are created using :meth:`gr_ctx.new`.
31+
32+
.. autoclass :: flint.types._gr.gr_ctx
33+
:members:
34+
:undoc-members:
35+
36+
.. autoclass :: flint.types._gr.gr_scalar_ctx
37+
:members:
38+
:undoc-members:
39+
40+
.. autoclass :: flint.types._gr.gr_poly_ctx
41+
:members:
42+
:undoc-members:
43+
44+
.. autoclass :: flint.types._gr.gr_mpoly_ctx
45+
:members:
46+
:undoc-members:
47+
48+
.. autoclass :: flint.types._gr._gr_fmpz_ctx
49+
:members:
50+
:undoc-members:
51+
52+
.. autoclass :: flint.types._gr._gr_fmpq_ctx
53+
:members:
54+
:undoc-members:
55+
56+
.. autoclass :: flint.types._gr._gr_fmpzi_ctx
57+
:members:
58+
:undoc-members:
59+
60+
.. autoclass :: flint.types._gr._gr_fexpr_ctx
61+
:members:
62+
:undoc-members:
63+
64+
.. autoclass :: flint.types._gr.gr_nmod_ctx
65+
:members:
66+
:undoc-members:
67+
68+
.. autoclass :: flint.types._gr.gr_fmpz_mod_ctx
69+
:members:
70+
:undoc-members:
71+
72+
.. autoclass :: flint.types._gr.gr_fq_ctx
73+
:members:
74+
:undoc-members:
75+
76+
.. autoclass :: flint.types._gr.gr_fq_nmod_ctx
77+
:members:
78+
:undoc-members:
79+
80+
.. autoclass :: flint.types._gr.gr_fq_zech_ctx
81+
:members:
82+
:undoc-members:
83+
84+
.. autoclass :: flint.types._gr.gr_nf_ctx
85+
:members:
86+
:undoc-members:
87+
88+
.. autoclass :: flint.types._gr.gr_nf_fmpz_poly_ctx
89+
:members:
90+
:undoc-members:
91+
92+
.. autoclass :: flint.types._gr.gr_real_qqbar_ctx
93+
:members:
94+
:undoc-members:
95+
96+
.. autoclass :: flint.types._gr.gr_complex_qqbar_ctx
97+
:members:
98+
:undoc-members:
99+
100+
.. autoclass :: flint.types._gr.gr_real_ca_ctx
101+
:members:
102+
:undoc-members:
103+
104+
.. autoclass :: flint.types._gr.gr_complex_ca_ctx
105+
:members:
106+
:undoc-members:
107+
108+
.. autoclass :: flint.types._gr.gr_real_algebraic_ca_ctx
109+
:members:
110+
:undoc-members:
111+
112+
.. autoclass :: flint.types._gr.gr_complex_algebraic_ca_ctx
113+
:members:
114+
:undoc-members:
115+
116+
.. autoclass :: flint.types._gr.gr_complex_extended_ca_ctx
117+
:members:
118+
:undoc-members:
119+
120+
.. autoclass :: flint.types._gr.gr_real_float_arf_ctx
121+
:members:
122+
:undoc-members:
123+
124+
.. autoclass :: flint.types._gr.gr_complex_float_acf_ctx
125+
:members:
126+
:undoc-members:
127+
128+
.. autoclass :: flint.types._gr.gr_real_arb_ctx
129+
:members:
130+
:undoc-members:
131+
132+
.. autoclass :: flint.types._gr.gr_complex_acb_ctx
133+
:members:
134+
:undoc-members:
135+
136+
.. autoclass :: flint.types._gr.gr_gr_poly_ctx
137+
:members:
138+
:undoc-members:
139+
140+
.. autoclass :: flint.types._gr.gr_gr_mpoly_ctx
141+
:members:
142+
:undoc-members:
143+
144+
.. autoclass :: flint.types._gr.gr_series_ctx
145+
:members:
146+
:undoc-members:
147+
148+
.. autoclass :: flint.types._gr.gr
149+
:members:
150+
:inherited-members:
151+
:undoc-members:

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100

101101
# The theme to use for HTML and HTML Help pages. See the documentation for
102102
# a list of builtin themes.
103-
html_theme = 'default'
103+
html_theme = 'furo'
104104

105105
# Theme options are theme-specific and customize the look and feel of a theme
106106
# further. For a list of options available for each theme, see the

doc/source/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,10 @@ Power series types
9696
arb_series.rst
9797
acb_series.rst
9898

99+
Experimental generic rings interface
100+
....................................
101+
102+
.. toctree::
103+
:maxdepth: 2
104+
105+
_gr.rst

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ coverage
88
pytest-cov
99
sphinx
1010
sphinx-rtd-theme
11+
furo

src/flint/flint_base/flint_base.pxd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from flint.flintlib.types.mpoly cimport ordering_t
22

3+
cdef class flint_ctx:
4+
pass
5+
36
cdef class flint_elem:
47
pass
58

0 commit comments

Comments
 (0)