| NEWS | R Documentation | 
News for R Package flint
Changes in version 0.1.2 (2025-10-10)
Compatibility
- Installation of flint version 0.1.1 failed under R versions 4.[3-4].z because the non-generic function - asplitin base did not admit a formal argument- drop. Compatibility is restored by conditional definition in- .onLoadof the S4 generic function and S4 method with signature- c(x = "flint").
Changes in version 0.1.1 (2025-10-08)
Description
-  Enhances: Rmpfr, gmpas.initForeigndefines methods for their classes.
Documentation
- There was a typo in ‘man/arb_hypgeom_bessel_j.Rd’, in the modified Bessel's equation, affecting only HTML and PDF output. 
Methods
- S4 methods are defined for generic (or made-generic) functions - apermand- asplit.
- S4 methods for - anyDuplicated,- duplicated, and- uniqueare amended to handle arrays- x. Accordingly they all gain an argument- MARGINwith default value- 1L.
-  summarycoerces to data frame and dispatches when its argument is a matrix, followingsummary.matrix.
-  printgains an argumentbase, which it passes toformat.
New Features
-  R functions flintBitsandflintBitsAccuratecan be used to get the number of bits necessary for exact representation of an integer or floating type number and the number of bits of an interval midpoint whose accuracy is guaranteed given the interval radius. These are experimental and so only partially documented.
-  R function .initForeigncan be used to define coercions between classes in flint and analogous classes in external packages, currently Rmpfr or gmp.
Bug Fixes
- Calls to - normmatching signature- c(x = "flint", type = "missing")signaled an error due to dispatch ambiguity, for some reason not detected by the call to- testInheritedMethodsin ‘tests/ambiguity.R’.
- Calls to - colSumsand friends whose return value would have length zero allowed undefined behaviour (divide-by-zero in integer division).
- Calls to - cbindand- rbindcould fill dimension names incorrectly when obtaining components from the call. Only the second component of the call (corresponding to the first actual argument) was “seen”.
-  as.data.framesignaled an error when its argument was an array due to a “too late” assignment.
-  Summarytransferred attributes from its argument to its return value, in methods for classesulongandslong.
-  mtfrmpassesdigits.mag = 0Ltoformatso thatmagvectors are also formatted exactly.
Internals
- External pointers are cleared by their finalizers. 
Changes in version 0.1.0 (2025-09-21)
Description
- Martin Maechler is a contributor. 
Significant User-Visible Changes
- See section ‘Classes’ for backwards incompatible changes to the definition of virtual class - flint.
- The class generator functions - .ulong,- .slong, ... are removed and replaced with pairs of class generator functions- ulong,- slong, ... and- ulong.array,- slong.array, ... with much nicer usage; see, e.g.,- help("ulong")for details.
- S4 methods for - initialize, which were nonstandard by virtue of not calling- callNextMethodin order to dispatch the default method, are removed in order to facilitate calls to- newby expert users wanting to set slots directly (rather than indirectly through class generator functions) or wanting to instantiate class extensions with additional slots, e.g.,- new("ulongWithExtraSlot", ulong, extra = .). Users relying on the earlier behaviour of- newshould start using the documented class generator functions.
-  R function flintIdenticalis removed and replaced by an S4 method for made-generic functionidentical.
Classes
- Virtual class - flintgains slots- dimand- dimnames, enabling representation of arrays. Methods for- flintand subclasses must handle these slots exactly as default methods handle the so-named attributes of traditional vectors.
- Virtual class - flintaccepts- NULLas a valid value for its- namesslot.- NULLis used instead of- character(0L)to indicate that an object is unnamed. Now- character(0L)is valid only for objects of length zero.
- New classes - OptionalInteger,- OptionalList, and- OptionalCharacter, defined as unions of- NULLand- integer,- list, or- character. They are used for slots- dim,- dimnames, and- namesof virtual class- flint.
Methods
- Many existing S4 methods are amended to handle changes in the definition of virtual class - flint, in particular to handle arrays. Notably, S4 methods for- [,- [<-,- [[, and- [[<-are refactored completely to support array subscripts.
- S4 methods are defined for generic (or made-generic) functions - %*%,- backsolve,- cbind2,- chol,- chol2inv,- colMeans,- colSums,- det,- determinant,- diag,- diag<-,- dim,- dim<-,- dimnames,- dimnames<-,- drop,- is.array,- is.matrix,- isSymmetric,- norm,- rbind2,- rowMeans,- rowSums,- solve,- t, and- tcrossprod. It is not a coindicence that these are all more or less array-specific.
- S3 methods are defined for S3-turned-S4 generic functions. These methods call the S4 generic function so that S4 dispatch occurs if the S3 generic function is called. 
- S4 methods are defined for generic functions - $and- $<-, signaling an informative error.
- An S4 method is defined for made-generic function - identicalso that- .xDataslots are handled specially when two- flintobjects are compared.
New Features
-  C library functions arb_hypgeom_bessel_j,acb_hypgeom_bessel_j,arb_hypgeom_bessel_y,acb_hypgeom_bessel_y,arb_hypgeom_bessel_i,acb_hypgeom_bessel_i,arb_hypgeom_bessel_k, andacb_hypgeom_bessel_k, which implement the Bessel and modified Bessel functions, are interfaced as R functions with identical names and prototypes. Requested by Martin Maechler.
-  R function flintClassfor getting the name of the direct nonvirtual subclass of virtual classflintfrom which the argument inherits, e.g.,"ulong"if the class of the argument is"ulong"or"ulongExtension".
-  R function asVectorfor coercion to basic vector classes andflintvector classes, optionally preserving attributes (at leastdim,dimnames,names). It handles attributes more uniformly thanas.vectorandas, which may or may not drop attributes depending on the class of the argument and the target class.
-  R functions cbind.flintandrbind.flint, similar in purpose toc.flint, enabling users to bypass the internal dispatch mechanism ofcbindandrbind.
- It is now defined how - flintLengthand- flintSizehandle arguments not inheriting from virtual class- flint.
-  MidandMid<-are implemented for classacb, getting and setting the complex midpoint. Thanks to Martin Maechler for the suggestion and patch (GH#15).
- S4 methods for - formatgain argument- digits.magand use that instead of- digitsto format- magand- magcomponents of- arband- acb. The S4 method for- printgains the same argument, passing it to- format.
Bug Fixes
- Due to a copy-paste bug, - Mid(x) <- valuenever worked for- xof class- arband- Imag(z) <- valuenever worked for- zof class- acfor- acb. Thanks to Martin Maechler for the report and patch (GH#15).
Changes in version 0.0.5 (2025-05-27)
Installation
-  ‘configure’ tests for ‘flint/flint.h’ from FLINT 3.1 more explicitly, and ‘src/noreturn.h’ uses the result of this test. Thanks to Brian Ripley for checks linking FLINT 3.2. 
-  ‘configure.ac’ calls macro AC_RUN_IFELSEinstead of macroAC_COMPILE_IFELSEwhere the former was always intended.
Changes in version 0.0.4 (2025-03-23)
Documentation
-  ‘man/flint-class.Rd’ contained a cut-paste error affecting section ‘Methods’, items [[and[[<-.
New Features
-  C library functions arb_hypgeom_gamma_lower,acb_hypgeom_gamma_lower,arb_hypgeom_gamma_upper,acb_hypgeom_gamma_upper,arb_hypgeom_beta_lower, andacb_hypgeom_beta_lower, which implement the incomplete gamma and beta functions, are interfaced as R functions with identical names and prototypes. Requested by Martin Maechler (GH#5).
-  R functions arb_hypgeom_betaandacb_hypgeom_betawrappingarb_hypgeom_gammaandacb_hypgeom_gammaare provided for completeness. FLINT provides no such entry points as of this writing.
Internals
-  R function complex.runiffacilitating complex-valued RNG in examples and tests.
Changes in version 0.0.3 (2025-02-23)
Installation
- Function - R_flint_abortis declared with keyword macro- FLINT_NORETURNconditionally, for compatibility with FLINT 3.0.
-  ‘configure’ tests for function d_mul_2expand ‘src/mag.c’ usesd_mul_2expconditionally, for compatibility with FLINT 3.0.
-  ‘configure’ works around broken ‘flint.pc’ installed by FLINT 3.0. 
-  ‘configure’ uses simpler prerequisite code when testing whether system header ‘flint/flint.h’ can be compiled. 
-  ‘src/noreturn.h’ is much refined, for compatibility with FLINT 3.0. The original version triggered clang-Wunknown-attributes.
-  ‘src/revertnoreturn.h’ is included after the FLINT headers so that definitions in ‘src/noreturn.h’ do not infect headers included later. 
Changes in version 0.0.2 (2025-02-20)
Installation
- An array declaration in ‘src/flint.h’ specified an incorrect (too small) array size, triggering - gcc-Wlto-type-mismatch. Thanks to Brian Ripley for the report.
-  ‘src/noreturn.h’ is included before the FLINT headers. FLINT 3.1 installs a broken ‘flint/flint.h’ whose use of keyword _Noreturnand keyword macronoreturnis not portable. Thanks to Brian Ripley for the report.
-  ‘configure’ wrongly assumed that ‘Rinternals.h’ must be located in ‘'R RHOME'/include’. Thanks to Dirk Eddelbuettel for the report (GH#3). 
- More pointers are zero-initialized to appease - clang-Wsometimes-uninitialized.
Changes in version 0.0.1 (2025-02-17)
Description
- The package is titled “Fast Library for Number Theory”, matching FLINT. 
- Mikael Jagan is the maintainer and sole author. 
-  Depends: R (>= 4.3)mainly for KaTeX support when rendering Rd to HTML and ‘amsmath’ support when rendering Rd to PDF.
-  Depends: methodsas flint defines S4 classes, generic functions, and methods.
-  Imports: statsas flint provides S3 and S4 methods forquantile.
-  SystemRequirements: flint (>= 3), mpfr (>= 3.1), gmpas flint links FLINT, GNU MPFR, and GNU MP. The version requirements are purely informational, as ‘configure’ and ‘configure.win’ scripts check that features used by the package are available.
Installation
- A ‘configure’ script is provided for installation under Unix. The script uses - pkg-configwhere available to determine options for linking FLINT, GNU MPFR, and GNU MP. The user can set environment variables PKG_CONFIG and PKG_CONFIG_PATH to control how- pkg-configis invoked and where it searches for ‘*.pc’ files. The script gives precedence to environment variables R_FLINT_CPPFLAGS, R_FLINT_CFLAGS, R_FLINT_LDFLAGS, and R_FLINT_LIBS: if any of these is set, then the script does not use- pkg-config. In that case, R_FLINT_LIBS gets a default value -lflint -lmpfr -lgmp. The other R_FLINT_* are empty by default.
- A ‘configure.win’ script is provided for installation under Windows. Currently, it invokes ‘configure’, passing along positional parameters, and does nothing else. 
Documentation
- S4 classes, generic functions, and methods are documented under help topics with keyword - classesor- methods. Interfaces to special mathematical functions are documented under help topics with keyword- math. One can use- help(package = "flint")or (for example)- help.search(package = "flint", keyword = "math")to get a list of (non-internal) help topics.
Classes
- Virtual class - flintwith nonvirtual subclasses- ulong,- slong,- fmpz,- fmpq,- mag,- arf,- acf,- arb, and- acb. Objects can be understood as vectors of length at most- 2^32-1or- 2^64-1(depending on the ABI) of the so-named C types. The implementation is based on external pointers.
-  ulongandslongrepresent vectors of fixed precision unsigned and signed integers. The integer size is 32 or 64 bits (depending on the ABI).
-  fmpzrepresents vectors of arbitrary precision signed integers.
-  fmpqrepresents vectors of arbitrary precision rational numbers, always in “canonical” form with numerator and positive, coprime denominator
-  magrepresents vectors of fixed precision error bounds.
-  arfandacfrepresent vectors of arbitrary precision floating-point real and complex numbers.
-  arbandacbrepresent vectors of arbitrary precision floating-point real and complex numbers with error bounds. They support “ball arithmetic”.
Generic Functions
- S4 generic functions - Num,- Num<-,- Den, and- Den<-for getting and setting numerators and denominators of quotients.
- S4 generic functions - Mid,- Mid<-,- Rad, and- Rad<-for getting and setting midpoints and radii of balls in a metric space.
- S4 generic functions - Real,- Real<-,- Imag, and- Imag<-for getting and setting real and imaginary parts of complex numbers.
Methods
- S4 methods are defined for generic (or made-generic) functions - [,- [<-,- [[,- [[<-,- Complex,- Den,- Den<-,- Imag,- Imag<-,- Math,- Math2,- Mid,- Mid<-,- Num,- Num<-,- Ops,- Rad,- Rad<-,- Real,- Real<-,- Summary,- all.equal,- anyDuplicated,- anyNA,- as.raw,- as.logical,- as.integer,- as.numeric,- as.complex,- as.vector,- as.matrix,- as.array,- as.data.frame,- as.Date,- as.POSIXct,- as.POSIXlt,- c,- coerce,- cut,- duplicated,- findInterval,- format,- initialize,- is.finite,- is.infinite,- is.na,- is.na<-,- is.nan,- is.unsorted,- length,- length<-,- match,- mean,- mtfrm,- names,- names<-,- print,- quantile,- rep,- rep.int,- rep_len,- show,- seq,- sequence,- summary,- unique, and- xtfrm.
- S3 methods are defined for S3-turned-S4 generic functions. These methods call the S4 generic function so that S4 dispatch occurs if the S3 generic function is called. 
New Features
- Generator functions for each of the nonvirtual subclasses of virtual class - flint.
-  C library functions arb_const_pi,arb_const_log2,arb_const_log10,arb_const_e,arb_lambertw,acb_lambertw,arb_dirichlet_zeta,acb_dirichlet_zeta,arb_dirichlet_hurwitz,acb_dirichlet_hurwitz,acb_dirichlet_lerch_phi,arb_hypgeom_gamma,acb_hypgeom_gamma,arb_hypgeom_rgamma,acb_hypgeom_rgamma,arb_hypgeom_lgamma,acb_hypgeom_lgamma,acb_hypgeom_polygamma,arb_hypgeom_2f1, andacb_hypgeom_2f1acb_polygamma,acb_dirichlet_zeta,acb_dirichlet_hurwitz,acb_dirichlet_lerch_phi,acb_hypgeom_gamma,acb_hypgeom_rgamma,acb_hypgeom_lgamma, andacb_hypgeom_2f1are interfaced as R functions with identical names and “prototypes”. Arguments are coerced to the correct class and recycled internally.
-  R function flintABIreturning the size in bits of C typemp_limb_t, either 32 or 64. The value is determined at configure time.
-  R function flintIdenticalfor testing whether twoflintvectors have identical class, length, and “content”. This test is less strict than the test for pointer equality done byidentical(x, y)whenxandyare external pointers.
-  R function flintLengthfor getting the length of aflintvector as aulongvector or, optionally, as a traditional numeric vector subject to rounding error.
-  R functions flintPrecandflintRndfor getting and setting the global default precision and rounding modes.
-  R function flintSizefor calculating the number of bytes used by aflintvector.
-  R function flintTriplereturning a character vector of length 3 of the formc(class, length, address), useful if details about aflintvector must be printed.
-  R function flintVersionreturning a list containing header and library versions for FLINT, GNU MPFR, and GNU MP. Header versions are determined at compile time. Library versions are determined at run time.
-  R function c.flint, the workhorse of the S4 method forc. It is exported to enable users to bypass the internal dispatch mechanism ofc, which dispatches on only the first positional argument.