[R] [R-pkgs] R package 'flint', an interface to the FLINT C library, now available on CRAN

Mikael Jagan j@g@nmn2 @end|ng |rom gm@||@com
Mon Feb 24 01:34:48 CET 2025


Dear R-packages/R-help subscribers,

Just writing to advertise that R package 'flint', interfacing the FLINT
C library for number theory, is now available on CRAN.

     https://cran.r-project.org/package=flint
     https://github.com/jaganmn/flint
     https://flintlib.org/

Thanks very much to the CRAN Team for its early guidance and clear documentation
on the correct approach to adding external libraries to the CRAN check servers:

     https://cran.r-project.org/web/packages/external_libs.html

I copy the R package description here and add some comments below for early
users.

Description:

     An R interface to 'FLINT' <https://flintlib.org/>, a C library for
     number theory.  'FLINT' extends GNU 'MPFR' <https://www.mpfr.org/>
     and GNU 'MP' <https://gmplib.org/> with support for arithmetic in
     standard rings (the integers, the integers modulo n, the rational,
     p-adic, real, and complex numbers) as well as vectors, matrices,
     polynomials, and power series over rings.  'FLINT' implements
     midpoint-radius interval arithmetic, also known as ball arithmetic,
     in the real and complex numbers, enabling computation in arbitrary
     precision with rigorous propagation of errors; see Johansson (2017)
     <doi:10.1109/TC.2017.2690633>.  Finally, 'FLINT' provides ball
     arithmetic implementations of many special mathematical functions,
     with high coverage of reference works such as the NIST Digital
     Library of Mathematical Functions <https://dlmf.nist.gov/>.  The R
     interface defines S4 classes, generic functions, and methods for
     representation and basic operations as well as plain R functions
     mirroring and vectorizing entry points in the C library.

Comments:

     * The C library is expansive:

           https://flintlib.org/doc/

       The R package makes no attempt to interface every C entry point.  Rather,
       users wanting an R interface to a C entry point are encouraged to file an
       issue requesting an implementation.  In this way, the interface will grow
       organically and "as needed" by the community of R users.

     * Of particular interest to applied mathematicians and statisticians will
       be special mathematical functions of real and complex arguments not
       previously supported by R or any R package available on CRAN (or, where
       supported, not defined over the complex numbers, to arbitrary precision,
       or beyond the radius of convergence of a power series representation).

       Use

           help.search(package = "flint", keyword = "math")

       to get an index of special mathematical functions currently interfaced.
       At the moment, this list excludes the (inverse) trigonometric, (inverse)
       hyperbolic, logarithmic, exponential, and other functions for which
       R provides S4 group generic functions 'Math', 'Math2', and 'Complex',
       for which the R package provides *methods* rather than plain R functions.

     * The interface to traditional number theoretic functionality (concerning
       integers, the integers modulo n, polynomials over the integers, ...) is
       small right now.  I don't personally have use for it.  But it can be
       expanded, again by request of users.

     * Installation from sources depends on FLINT, GNU MPFR, and GNU MP headers
       and libraries.  Use your operating system's package manager to install
       these ...

           $ pacman -S flint
           $ apt install libflint-dev
           $ dnf install flint-devel
           $ pkg install flint
           $ port install flint
           $ brew install flint

       ... unless ...

       (1) The repositories provide a too old (< 3.0.0) version of FLINT, in
           which case consider building FLINT from a recent (>= 3.0.0) source
           tarball obtained here:

               https://github.com/flintlib/flint/releases

       (2) You use Windows and obtained R from CRAN, in which case use the
           headers and libraries from a recent enough Rtools (>= Rtools44 r6414)

               https://cran.r-project.org/bin/windows/Rtools/
               https://cran.r-project.org/bin/windows/Rtools/rtools44/news.html

           choosing the Rtools installer built for your architecture (x86_64 or
           aarch64).

       (3) You use macOS and obtained R from CRAN, in which case install the
           macOS binaries (for flint, mpfr, and gmp) maintained by Simon Urbanek

               https://mac.r-project.org/bin/
               https://mac.r-project.org/bin/darwin20/x86_64/
               https://mac.r-project.org/bin/darwin20/arm64/

           choosing the binaries built for your architecture (x86_64 or arm64).

Comments from early users are very much welcome and appreciated.

Mikael

_______________________________________________
R-packages mailing list
R-packages using r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages



More information about the R-help mailing list