Dear FLINT-dev,
I have just converted my code for computing Bianchi modular forms (
https://github.com/JohnCremona/bianchi-progs) to use FLINT 3 for its base integer type. This is a very minimal use of FLINT. Bianchi-progs builds on my eclib library, defining its own classes for dealing with imaginary quadratic integers, field elements, ideals -- and modular symbols. Originally the base type for the quadratic integers was long int, which works fine until they overflow (and the code has a lot of assert statements to catch when that happens. Then I rewrote it so that (via a complile-time switch) it could use NTL's ZZ type -- this made sense as eclib uses these all over the place. That works well but is very very much slower.
Last week I wrote my own little C++ wrapper around your fmpz_t -- just to provide the function I need, it's only 142 lines of header (mostly inline fcuntions calling a flint function) plus 120 lines for a few longer function implementations. Now bianchi-progs uses this as its base type by default. And while that is slower than using long ints, it is *very* much faster than using ZZ. (I don't exactly know why -- NTL's ZZ is basically a C++ wrapper around gmp integers).
My test suite in bianchi-progs is designed to work even with long ints (it only runs on inputs which do not overflow), and the timings on a laptop are as follows:
long: 4m 24s
ZZ: 78m 25s
fmpz: 15m 47s
Thanks!
You may wonder why I haven't been using FLINT for years. Well, eclib goes back a long way, longer than FLINT's first release, and I started using NTL very early on. And I write in C++ rather than C, so I liked the fact that NTL is C++. I never got around to trying out FLINT2's C++ wrappings -- is that project still alive, and will it be updated to work with FLINT3? I found it on github (but Google finds
https://flintlib.org/doc/flintxx.html which no longer exists). There's a case to be made for converting all of eclib to use FLINT instead of NTL, but that would be a lot of work. (For the record, the components of NTL used in eclib are: ZZ and polynomials and matrices over ZZ including factoring in ZZ[X]; integers mod p, polynomials and matrices over these; RR (reals) over which I build my own CC; matrices over RR (just for small determinants).
Looking at this the other way round, if I converted all my code for elliptic curves over Q to use FLINT, you could consider that as contributing a library of elliptic curve functions to FLINT. That would be a nice project for somebody...else!
John