Hi all,

Yesterday I pushed out the 0.7.0 release of python-flint to PyPI and GitHub.

This release was delayed for some time because I was hoping to work a
bit on tidying up some of the newly added interfaces. Recent reported
issues show that people were clearly just using the alpha releases
though and now that FLINT 3.2.0 is released it seems like a good time
just to get the release out with all the new features and
improvements.

This release contains work from over 100 pull requests from 7
contributors and has some major changes and new features:

- finite fields
- multivariate polynomials
- acb_theta
- an experimental interface for generics (providing nf, qqbar, calcium, ...)
- new build system: meson instead of setuptools
- new platforms: Linux on ARM and free-threaded CPython

There are binaries on PyPI for CPython 3.11, 3.12, 3.13 and 3.13t
(free-threading) for:

  Windows x86-64
  MacOS x86-64 and arm64
  Linux (manylinux) x86-64 and aarch64.

For any of those platforms you should just be able to do:

  $ pip install python-flint.

Those binaries bundle the latest FLINT 3.2.0 which provides many
improvements in FLINT itself since 3.0.1 which was bundled by
python-flint 0.6.0.

Possibly it will take a little time for a new conda package to appear
because the build system has switched from setuptools to meson which
has better handling of detecting compilers, finding C libraries,
parallel builds etc. If you have C compilers and pkgconfig can find
FLINT then it should be as simple as pip install python-flint to build
from source as well. FLINT versions 3.0-3.2 are supported but some
features will be disabled if built for older FLINT versions.

After install you can run the tests with:

  $ python -m flint.test

Those tests take literally a couple of seconds so it is worth running
them and please let us know if you see any failures.

The Linux on ARM platform is new. The binaries are built and tested in
CI but I don't have access to Linux on ARM hardware so I have not done
any local testing and I don't know that anyone else has either. I
would be interested to hear from anyone just that the test suite
(hopefully) passes.

CPython 3.13 has a new free threaded 3.13t build which removes the
GIL. Binaries for 3.13t are provided and have been lightly tested
(there are no tests that actually exercise concurrency). The free
threaded build should make it possible to benefit from thread
parallelism at the Python level rather than FLINT's internal use of
threads. However python-flint does not currently use any locks to
guarantee thread-safety for mutable types like matrices and
polynomials.

Any objects shared between multiple threads should be treated as
immutable in the free threaded build. I have confirmed that setting an
element of an fmpz_mat like M[i,j] = 10**100 can cause a segfault if
done simultaneously from multiple threads. Provided shared objects are
not mutated there are no known thread safety problems. It is possible
that in future we could have safer interfaces for multithreading
(immutable matrices?) but for now thread safety works on a consenting
adults basis.


Contributors
----------------

Many thanks to the following people who contributed to this release:

  Jake Moss
  Giacomo Pope
  Joris Roos
  Edgar Costa
  Frédéric Chapoton
  Oscar Benjamin
  Tom Hubrecht


Changes
------------

The full changelog is in the README:

https://github.com/flintlib/python-flint?tab=readme-ov-file#070

The documentation is now hosted on readthedocs:

https://python-flint.readthedocs.io/en/latest/

There are a lot of changes and new features in this release. There are
many small changes like adding new functions, making the methods more
consistent across types, improved error handling, preventing crashes
and general code improvements.

There are also some big new features:

Finite fields and univariate polynomials over finite fields have been
added in work by Giacomo Pope. This uses the fq_default interface in
FLINT and so it wraps all the different finite field types (fq_nmod,
fq_zech, etc).

Example GF(9):

  >>> import flint
  >>> ctx = flint.fq_default_ctx(3, 2)
  >>> z = ctx.gen()
  >>> (1 + z)**5
  z + 1

Multivariate polynomials over integers, rationals and integers mod n
have been added in work by Jake Moss adding new fmpz_mpoly,
fmpq_mpoly, nmod_mpoly and fmpz_mod_mpoly types.

Example ZZ[x,y]:

  >>> R = flint.fmpz_mpoly_ctx.get(['x', 'y'])
  >>> R
  fmpz_mpoly_ctx(2, '<Ordering.lex: 'lex'>', ('x', 'y'))
  >>> x, y = R.gens()
  >>> p = x**2 - y**2
  >>> p
  x^2 - y^2
  >>> p.factor()
  (1, [(x + y, 1), (x - y, 1)])

FLINT's acb_theta module was added by Edgar Costa:

  >>> from flint.types.acb_theta import acb_theta
  >>> A = flint.acb_mat([[1+1j]])
  >>> acb_theta(A, A)
  [[-21.1408540317901 +/- 2.32e-14] + [+/- 4.02e-15]j, ...

There is a new experimental interface for FLINT's generic types added
by myself and subsequently improved by Tom Hubrecht. This exposes many
FLINT types that do not otherwise have wrappers in python-flint such
as fmpzi, nf, qqbar, calcium etc as well as polynomials, series and
multivariate polynomials over all of these types (no matrices yet...):

Example calcium and multivariate polynomials over calcium:

  >>> import flint.types._gr as gr
  >>> C = gr.gr_complex_ca_ctx.new()
  >>> C.sqrt(2)
  1.41421 {a where a = 1.41421 [a^2-2=0]}
  >>> C.sqrt(2)**2
  2
  >>> R = gr.gr_gr_mpoly_ctx.new(C, ['x', 'y'])
  >>> x, y = R.gens()
  >>> x + R(C.sqrt(2))*y
  x + (1.41421 {a where a = 1.41421 [a^2-2=0]})*y

The generic interface here is very much an early work in progress.
This is also under active development in FLINT itself so make sure to
use FLINT 3.2.0 if testing this. Don't be surprised if some things
don't work that well at the moment but please do open GitHub issues
for any improvements that would make it more immediately usable.


Future plans
-----------------

Going forwards I think that the big things to do are:

- Complete the generics interface and make it well tested.
- Make the generic interface more intuitive to use like ZZ.poly_ring() etc.
- Restructure the codebase so that most types are based on the generic
interfaces.
- Add other major non-generic FLINT features like fq_embed etc.
- Add better conversions/coercions both within python-flint and also
with other types/libraries.
- Add type stubs for use with downstream Python type checkers.

--
Oscar Benjamin

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/CAHVvXxRDxgn200SG%3DfRuXoFumhSxtC%3DWPNoxijDfSLQ1Ait5fA%40mail.gmail.com.

Reply via email to