Learn R Programming

flint (version 0.0.3)

acf-class: Arbitrary Precision Floating-Point Complex Numbers

Description

Class acf extends virtual class flint. It represents vectors of arbitrary precision floating-point complex numbers. Elements have real and imaginary parts, each with arbitrary precision significand and exponent. The underlying C type can represent NaN, -Inf, and Inf real and imaginary parts.

Note that package stats exports a function acf, referring to autocovariance and autocorrelation functions of time series. It returns objects of informal S3 class acf, for which a small number of informal S3 methods are registered. The formal S4 class and methods documented here are entirely unrelated.

Usage

## The class generator function:
.acf(...)

## Mode 1: initialize with zeros ## .acf(length = 0L) ## ## Mode 2: initialize with vector ## .acf(length = length(x), x) ## ## Mode 3: initialize by parts ## .acf(length = max0(length(real), length(imag)), real, imag) ## ## where max0 <- function(m, n) if (min(m, n)) max(m, n) else 0L

Value

The class generator function returns new("acf", ...).

Arguments

...

arguments passed to methods for initialize.

Slots

.xData, names

inherited from virtual class flint.

Methods

Due to constraints imposed by generic functions, methods typically do not provide a formal argument prec allowing for a precision to be indicated in the function call. Such methods use the current default precision set by flintPrec.

!

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

+

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

-

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

Complex

signature(z = "acf"):
mathematical functions of one argument; see S4groupGeneric.

Math

signature(x = "acf"):
mathematical functions of one argument; see S4groupGeneric. Member functions floor, ceiling, trunc, cummin, cummax are not implemented.

Math2

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

Ops

signature(e1 = "ANY", e2 = "acf"):
signature(e1 = "acf", 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 = "acf"):
univariate summary statistics; see S4groupGeneric. The return value is a logical vector of length 1 (any, all) or an acf vector of length 1 or 2 (sum, prod). Member functions min, max, range are not implemented.

anyNA

signature(x = "acf"):
returns TRUE if any element of x has real or imaginary part NaN, FALSE otherwise.

as.vector

signature(x = "acf"):
returns as.vector(y, mode), where y is a complex vector containing the result of converting the real and imaginary parts 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 (with precedence to even significands in case of ties), unless parts exceed .Machine[["double.xmax"]] in absolute value, in which case -Inf or Inf is introduced with a warning. Coercion to types "character", "symbol" (synonym "name"), "pairlist", "list", and "expression", which are not “number-like”, is handled specially.

coerce

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

format

signature(x = "acf"):
returns a character vector suitable for printing, using string format "a+bi" and scientific format for each a and b. Optional arguments control the output; see format-methods.

initialize

signature(.Object = "acf", 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 = "acf", length = "numeric", x = "atomic|flint"):
as above, except that the new slot value points to an array initialized with values from x.

initialize

signature(.Object = "acf", length = "numeric", real = "atomic|flint", imag = "atomic|flint"):
as above, except that the new slot value points to an array whose real and imaginary parts are initialized separately with values from real and imag, which are coerced to class arf and recycled as necessary.

is.finite

signature(x = "acf"):
returns a logical vector indicating which elements of x do not have real or imaginary part NaN, -Inf, or Inf.

is.infinite

signature(x = "acf"):
returns a logical vector indicating which elements of x have real or imaginary part -Inf or Inf.

is.na, is.nan

signature(x = "acf"):
returns a logical vector indicating which elements of x have real or imaginary part NaN.

is.unsorted

signature(x = "acf"):
returns a logical indicating if x is not sorted in nondecreasing order (increasing order if optional argument strictly is set to TRUE) by real part then by imaginary part.

mean

signature(x = "acf"):
returns the arithmetic mean.

xtfrm

signature(x = "acf"):
returns a numeric vector that sorts in the same order as x. The permutation order(xtfrm(x), ...) orders x first by its real part then by its imaginary part, with the caveat that all a+NaNi and NaN+bi have equal precedence (for compatibility with base).

See Also

Virtual class flint. Generic functions Real and Imag and their replacement forms for getting and setting real and imaginary parts.

Examples

Run this code
showClass("acf")
showMethods(classes = "acf")

Run the code above in your browser using DataLab