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 unrelated.
The class generator functions are named ACF
and
ACF.array
instead of acf
and acf.array
because
an exported function named acf
would mask the function in
package stats.
## Class generator functionsACF(x = 0i, length = 0L, names = NULL, real = 0, imag = 0)
ACF.array(x = 0i, dim = length(x), dimnames = NULL, real = 0, imag = 0)
An acf
vector, possibly an array; see ‘Details’.
an atomic or flint
vector containing data for
conversion to acf
.
a numeric vector of length one giving the length of the return
value. If that exceeds the length of x
, then x
is
recycled. Non-integer values are rounded in the direction of zero.
the names
slot of the return value, either NULL
or a
character vector of equal length. Non-character names
are
coerced to character.
the dim
slot of the return value, an integer vector of
nonzero length. If the product exceeds the length of x
, then
x
is recycled. Non-integer numeric dim
are coerced to
integer.
the dimnames
slot of the return value, either NULL
or
a list of length equal to the length of dim
. The components
are either NULL
or character vectors of length given by
dim
. Non-character vector components of dimnames
are
coerced to character.
atomic or flint
vectors containing data for
conversion to arf
. Use these instead of
x
for initialization “by parts” (real and imaginary).
Real numbers and real and imaginary parts of complex numbers are
rounded according to the default precision and rounding mode set by
flintPrec
and flintRnd
.
Character strings are scanned first for a real part then for an
imaginary part. They can use any of three formats:
"sa"
, "tbi"
, and
"satbi"
, where s
and
a
define the sign and absolute value of the real part and
t
and b
define the sign and absolute value
of the imaginary part. s
can be empty if the real part
is NaN
or non-negative. t
can be empty if the
imaginary part is NaN
or non-negative, but only in the second
format.
The sequences sa
and tb
are
converted using function mpfr_strtofr
from the GNU
MPFR library with argument base
set to 0 and argument
rnd
set according to the default rounding mode; see
https://www.mpfr.org/mpfr-current/mpfr.html#Assignment-Functions.
.xData
, dim
, dimnames
, names
inherited from virtual class flint
.
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
.
%*%
, crossprod
, tcrossprod
signature(x = "acf", y = "acf")
:
signature(x = "acf", y = "ANY")
:
signature(x = "ANY", y = "acf")
:
matrix products. The “other” operand must be atomic or
inherit from virtual class flint
.
crossprod
and tcrossprod
behave as if y = x
when y
is missing or NULL
. Operands are promoted as
necessary and must be conformable (have compatible dimensions).
Non-array operands of length k
are handled as 1-by-k
or k
-by-1 matrices depending on the call. The return value
is approximate insofar that it may not be correctly rounded.
+
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 = "acf", e2 = "acf")
:
signature(e1 = "acf", e2 = "ANY")
:
signature(e1 = "ANY", e2 = "acf")
:
binary arithmetic, comparison, and logical operators; see
S4groupGeneric
. The “other” operand
must be atomic or inherit from virtual class
flint
. Operands are promoted as necessary.
Array operands must be conformable (have identical dimensions).
Non-array operands are recycled.
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. See also asVector
.
backsolve
signature(r = "acf", x = "acf")
:
signature(r = "acf", x = "ANY")
:
signature(r = "ANY", x = "acf")
:
solution of the triangular system op2(op1(r)) %*% y = x
,
where op1=ifelse(upper.tri, triu, tril)
and
op2=ifelse(transpose, t, identity)
and upper.tri
and transpose
are optional logical arguments with default
values TRUE
and FALSE
, respectively. The
“other” operand must be atomic or inherit from virtual
class flint
. If x
is missing, then
the return value is the inverse of op2(op1(r))
, as if
x
were the identity matrix. Operands are promoted as
necessary and must be conformable (have compatible dimensions).
Non-array x
are handled as length(x)
-by-1 matrices.
chol
signature(x = "acf")
:
returns the upper triangular Cholesky factor of the positive
definite matrix whose upper triangular part is the upper
triangular part of x
(discarding imaginary parts of
diagonal entries).
chol2inv
signature(x = "acf")
:
returns the inverse of the positive definite matrix whose upper
triangular Cholesky factor is the upper triangular part of
x
(discarding imaginary parts of diagonal entries).
coerce
signature(from = "ANY", to = "acf")
:
returns the value of acf.(from)
.
colSums
, colMeans
signature(x = "acf")
:
returns an acf
vector or array containing the column sums
or means of x
, defined as sums or means over dimensions
1:dims
.
det
signature(x = "acf")
:
returns the determinant of x
as an acf
vector of
length 1.
determinant
signature(x = "acf")
:
returns a list with components modulus
and argument
specifying the determinant of x
, following the base
function (except for the use of argument instead of sign), hence
see determinant
.
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
.
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.
rowSums
, rowMeans
signature(x = "acf")
:
returns an acf
vector or array containing the row sums or
means of x
, defined as sums or means over dimensions
(dims+1):length(dim(x))
.
solve
signature(a = "acf", b = "acf")
:
signature(a = "acf", b = "ANY")
:
signature(a = "ANY", b = "acf")
:
solution of the general system a %*% x = b
. The
“other” operand must be atomic or inherit from virtual
class flint
. If b
is missing, then
the return value is the inverse of a
, as if b
were
the identity matrix. Operands are promoted as necessary and must
be conformable (have compatible dimensions). Non-array b
are handled as length(b)
-by-1 matrices.
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).
The class generator function has six distinct usages:
acf.()
acf.(length=)
acf.(x)
acf.(x, length=)
acf.(real=, imag=)
acf.(real=, imag=, length=)
The first usage generates an empty vector. The second usage generates
a zero vector of the indicated length. The third usage converts
x
, preserving dimensions, dimension names, and names. The
fourth usage converts x
, recycling its elements to the
indicated length and discarding its dimensions, dimension names, and
names. The fifth and sixth usages, in which either of real
and
imag
can be missing, use arf(real)
and
arf(imag)
to separately initialize the real and
imaginary parts of the acf
return value.
Attempts to recycle real
, imag
, or x
of length
zero to nonzero length are an error.
Usage of acf.array
is modelled after array
.
Virtual class flint
. Generic functions
Real
and Imag
and their replacement forms
for getting and setting real and imaginary parts.
showClass("acf")
showMethods(classes = "acf")
Run the code above in your browser using DataLab