| 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 argumentdrop. Compatibility is restored by conditional definition in.onLoadof the S4 generic function and S4 method with signaturec(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
apermandasplit.S4 methods for
anyDuplicated,duplicated, anduniqueare amended to handle arraysx. Accordingly they all gain an argumentMARGINwith default value1L.-
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 signaturec(x = "flint", type = "missing")signaled an error due to dispatch ambiguity, for some reason not detected by the call totestInheritedMethodsin ‘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
cbindandrbindcould 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 functionsulong,slong, ... andulong.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 callingcallNextMethodin order to dispatch the default method, are removed in order to facilitate calls tonewby 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 ofnewshould 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 slotsdimanddimnames, enabling representation of arrays. Methods forflintand subclasses must handle these slots exactly as default methods handle the so-named attributes of traditional vectors.Virtual class
flintacceptsNULLas a valid value for itsnamesslot.NULLis used instead ofcharacter(0L)to indicate that an object is unnamed. Nowcharacter(0L)is valid only for objects of length zero.New classes
OptionalInteger,OptionalList, andOptionalCharacter, defined as unions ofNULLandinteger,list, orcharacter. They are used for slotsdim,dimnames, andnamesof virtual classflint.
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, andtcrossprod. 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 twoflintobjects 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
flintLengthandflintSizehandle arguments not inheriting from virtual classflint.-
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 argumentdigits.magand use that instead ofdigitsto formatmagandmagcomponents ofarbandacb. The S4 method forprintgains the same argument, passing it toformat.
Bug Fixes
Due to a copy-paste bug,
Mid(x) <- valuenever worked forxof classarbandImag(z) <- valuenever worked forzof classacforacb. 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 macroFLINT_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 howpkg-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 usepkg-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
classesormethods. Interfaces to special mathematical functions are documented under help topics with keywordmath. One can usehelp(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 subclassesulong,slong,fmpz,fmpq,mag,arf,acf,arb, andacb. Objects can be understood as vectors of length at most2^32-1or2^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, andDen<-for getting and setting numerators and denominators of quotients.S4 generic functions
Mid,Mid<-,Rad, andRad<-for getting and setting midpoints and radii of balls in a metric space.S4 generic functions
Real,Real<-,Imag, andImag<-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, andxtfrm.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.