Skip to content

Commit

Permalink
Merge pull request #227 from oscarbenjamin/pr_bump_versions
Browse files Browse the repository at this point in the history
Bump version to 0.7.0a5
  • Loading branch information
oscarbenjamin authored Sep 15, 2024
2 parents bbc459f + db5ae7d commit e7e3072
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 129 deletions.
14 changes: 9 additions & 5 deletions doc/source/_gr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ variables over the Gaussian integers :math:`\mathbb{Z}[i][x,y]` we would do::
>>> ctx = gr_gr_mpoly_ctx.new(gr_fmpzi_ctx, ["x", "y"])
>>> ctx.gens()
[x, y]
>>> ctx.gens_recursive()
[I, x, y]
>>> I, x, y = ctx.gens_recursive()
>>> p = (x + y + I)**2

# XXX: gens_recursive not available in FLINT < 3.1
# >>> ctx.gens_recursive()
# [I, x, y]
# >>> I, x, y = ctx.gens_recursive()

>>> x, y = ctx.gens()
>>> p = (x + y)**2
>>> p
x^2 + 2*x*y + (2*I)*x + y^2 + (2*I)*y - 1
x^2 + 2*x*y + y^2

Some domains such as ``gr_fmpzi_ctx`` are global and do not need to be created.
Others such as ``gr_gr_mpoly_ctx`` are created using :meth:`gr_ctx.new`.
Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
# built documents.
#
# The short X.Y version.
version = '0.7.0a4'
version = '0.7.0a5'
# The full version, including alpha/beta/rc tags.
release = '0.7.0a4'
release = '0.7.0a5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "python-flint"
description = "Bindings for FLINT"
version = "0.7.0a4"
version = "0.7.0a5"
# This needs to be in sync with README, cibuildwheel and CI config.
requires-python = ">= 3.10"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion src/flint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
Ordering,
)

__version__ = '0.7.0a4'
__version__ = '0.7.0a5'
2 changes: 1 addition & 1 deletion src/flint/test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def raises(f, exception):

def test_pyflint():

assert flint.__version__ == "0.7.0a4"
assert flint.__version__ == "0.7.0a5"

ctx = flint.ctx
assert str(ctx) == repr(ctx) == _default_ctx_string
Expand Down
60 changes: 37 additions & 23 deletions src/flint/types/_gr.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ from flint.flintlib.functions.gr_domains cimport (

gr_ctx_init_real_qqbar,
gr_ctx_init_complex_qqbar,
_gr_ctx_qqbar_set_limits,
# _gr_ctx_qqbar_set_limits,

gr_ctx_init_real_ca,
gr_ctx_init_complex_ca,
Expand All @@ -89,13 +89,14 @@ from flint.flintlib.functions.gr cimport (
gr_set_str,
gr_get_str,
gr_set,
gr_set_si,
gr_get_si,

gr_zero,
gr_one,
gr_gen,
gr_gens,
gr_gens_recursive,
# gr_gens_recursive,
gr_ctx_set_gen_names,

gr_i,
Expand Down Expand Up @@ -224,6 +225,15 @@ cdef class gr_ctx(flint_ctx):
raise self._error(err, "Failed to parse string")
return py_val

@cython.final
cdef inline gr from_si(self, slong n):
cdef gr py_val
py_val = self.new_gr()
err = gr_set_si(py_val.pval, n, self.ctx_t)
if err != GR_SUCCESS:
raise self._error(err, "Failed to parse string")
return py_val

@cython.final
cdef inline str to_str(self, val: gr):
cdef str py_str
Expand Down Expand Up @@ -348,25 +358,25 @@ cdef class gr_ctx(flint_ctx):
gr_vec_clear(gens, self.ctx_t)
return py_gens

@cython.final
cdef inline list _gens_recursive(self):
cdef int err
cdef gr g
cdef gr_vec_t gens
gr_vec_init(gens, 0, self.ctx_t)
err = gr_gens_recursive(gens, self.ctx_t)
if err != GR_SUCCESS:
raise self._error(err, "Cannot get recursive generators")
length = gr_vec_length(gens, self.ctx_t)
py_gens = [None] * length
for 0 <= i < length:
g = self.new_gr()
err = gr_set(g.pval, gr_vec_entry_ptr(gens, i, self.ctx_t), self.ctx_t)
if err != GR_SUCCESS:
raise self._error(err, "Failed to copy generator.")
py_gens[i] = g
gr_vec_clear(gens, self.ctx_t)
return py_gens
# @cython.final
# cdef inline list _gens_recursive(self):
# cdef int err
# cdef gr g
# cdef gr_vec_t gens
# gr_vec_init(gens, 0, self.ctx_t)
# err = gr_gens_recursive(gens, self.ctx_t)
# if err != GR_SUCCESS:
# raise self._error(err, "Cannot get recursive generators")
# length = gr_vec_length(gens, self.ctx_t)
# py_gens = [None] * length
# for 0 <= i < length:
# g = self.new_gr()
# err = gr_set(g.pval, gr_vec_entry_ptr(gens, i, self.ctx_t), self.ctx_t)
# if err != GR_SUCCESS:
# raise self._error(err, "Failed to copy generator.")
# py_gens[i] = g
# gr_vec_clear(gens, self.ctx_t)
# return py_gens


cdef class gr_scalar_ctx(gr_ctx):
Expand Down Expand Up @@ -584,7 +594,9 @@ cdef class gr_real_qqbar_ctx(gr_scalar_ctx):
ctx.bits_limit = bits_limit
if deg_limit != -1 or bits_limit != -1:
# Maybe add setters for these?
_gr_ctx_qqbar_set_limits(ctx.ctx_t, deg_limit, bits_limit)
# XXX: Not available in FLINT 3.0.1
# _gr_ctx_qqbar_set_limits(ctx.ctx_t, deg_limit, bits_limit)
pass
return ctx


Expand All @@ -603,7 +615,9 @@ cdef class gr_complex_qqbar_ctx(gr_scalar_ctx):
ctx.bits_limit = bits_limit
if deg_limit != -1 or bits_limit != -1:
# Maybe add setters for these?
_gr_ctx_qqbar_set_limits(ctx.ctx_t, deg_limit, bits_limit)
# XXX: Not available in FLINT 3.0.1
# _gr_ctx_qqbar_set_limits(ctx.ctx_t, deg_limit, bits_limit)
pass
return ctx


Expand Down
Loading

0 comments on commit e7e3072

Please sign in to comment.