Learn R Programming

flint (version 0.0.3)

slong-class: Fixed Precision Unsigned and Signed Integers

Description

Classes ulong and slong extend virtual class flint. They represent vectors of fixed precision unsigned and signed integers, respectively. The integer size is 32 or 64 bits, depending on the ABI; see flintABI. There is no representation for R's missing value NA_integer_.

Usage

## The class generator functions:
.ulong(...)
.slong(...)

## Mode 1: initialize with zeros ## .ulong(length = 0L) ## .slong(length = 0L) ## ## Mode 2: initialize with vector ## .ulong(length = length(x), x) ## .slong(length = length(x), x)

Value

The class generator functions return

new("ulong", ...) and

new("slong", ...).

Arguments

...

arguments passed to methods for initialize.

Slots

.xData, names

inherited from virtual class flint.

Methods

!

signature(x = "ulong"):
signature(x = "slong"):
equivalent to (but faster than) x == 0.

+

signature(e1 = "ulong", e2 = "missing"):
signature(e1 = "slong", e2 = "missing"):
returns a copy of the argument.

-

signature(e1 = "ulong", e2 = "missing"):
signature(e1 = "slong", e2 = "missing"):
returns the negation of the argument.

Complex

signature(z = "ulong"):
signature(z = "slong"):
mathematical functions of one argument; see S4groupGeneric. Member functions requiring promotion to a floating-point type may not be implemented.

Math

signature(x = "ulong"):
signature(x = "slong"):
mathematical functions of one argument; see S4groupGeneric. Member functions requiring promotion to a floating-point type may not be implemented.

Math2

signature(x = "ulong"):
signature(x = "slong"):
decimal rounding according to a second argument digits; see S4groupGeneric. There are just two member member functions: round, signif.

Ops

signature(e1 = "ANY", e2 = "ulong"):
signature(e1 = "ANY", e2 = "slong"):
signature(e1 = "ulong", e2 = "ANY"):
signature(e1 = "slong", e2 = "ANY"):
binary arithmetic, comparison, and logical operators; see S4groupGeneric. The “other” operand must be atomic or inherit from virtual class flint. The operands are recycled and promoted as necessary.

Summary

signature(x = "ulong"):
signature(x = "slong"):
univariate summary statistics; see S4groupGeneric. The return value is a logical vector of length 1 (any, all) or a ulong, slong, or fmpz vector of length 1 or 2 (sum, prod, min, max, range).

anyNA

signature(x = "ulong"):
signature(x = "slong"):
returns FALSE, as ulong and slong have no representation for NaN.

as.vector

signature(x = "ulong"):
signature(x = "slong"):
returns as.vector(y, mode), where y is a double vector containing the result of converting each element of x to the range of double, rounding if the value is not exactly representable in double precision. The rounding mode is to the nearest representable number in the direction of zero. Coercion to types "character", "symbol" (synonym "name"), "pairlist", "list", and "expression", which are not “number-like”, is handled specially.

coerce

signature(from = "ANY", to = "ulong"):
signature(from = "ANY", to = "slong"):
returns .ulong(x = from) or .slong(x = from). An error is signaled if the class or type of from is not supported by the methods for initialize.

format

signature(x = "ulong"):
signature(x = "slong"):
returns a character vector suitable for printing. Optional arguments control the output; see format-methods.

initialize

signature(.Object = "ulong", length = "numeric"):
signature(.Object = "slong", length = "numeric"):
returns .Object after setting its .xData slot. The new slot value is an external pointer to an array of the corresponding C type, which is newly allocated and initialized entirely with zeros. .Object is not copied, so all references are affected.

initialize

signature(.Object = "ulong", length = "numeric", x = "atomic|flint"):
signature(.Object = "slong", length = "numeric", x = "atomic|flint"):
as above, except that the new slot value points to an array initialized with values from x truncated towards zero. An error is signaled if elements of x are not in the range of the C type, in particular if elements are NaN. The range is \((-1, 2^{n})\) for ulong and \((-2^{n-1}-1, 2^{n-1})\) for slong, where \(n\) is the value of flintABI().

is.finite

signature(x = "ulong"):
signature(x = "slong"):
returns a logical vector whose elements are all TRUE, as ulong and slong have no representation for NaN, -Inf, and Inf.

is.infinite, is.na, is.nan

signature(x = "ulong"):
signature(x = "slong"):
returns a logical vector whose elements are all FALSE, as ulong and slong have no representation for NaN, -Inf, and Inf.

is.unsorted

signature(x = "ulong"):
signature(x = "slong"):
returns a logical indicating if x is not sorted in nondecreasing order (increasing order if optional argument strictly is set to TRUE).

mean

signature(x = "ulong"):
signature(x = "slong"):
returns the arithmetic mean. An error is signaled if the argument length is 0, because the return type is fmpq which cannot represent the result of division by 0.

References

The FLINT documentation of the underlying C types: https://flintlib.org/doc/flint.html

See Also

Virtual class flint.

Examples

Run this code
showClass("ulong")
showClass("slong")
showMethods(classes = c("ulong", "slong"))

Run the code above in your browser using DataLab