Class acb extends virtual class flint. It represents
vectors of complex numbers with error bounds on the real and imaginary
parts. Elements are specified by two pairs of mixed format
floating-point numbers: an arb real part and an
arb imaginary part, each specified by an
arf midpoint and a mag
radius.
## Class generator functionsacb(x = 0i, length = 0L, names = NULL, real = 0, imag = 0,
prec = NULL)
acb.array(x = 0i, dim = length(x), dimnames = NULL, real = 0, imag = 0,
prec = NULL)
An acb vector, possibly an array; see ‘Details’.
an atomic or flint vector containing data for
conversion to acb.
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 arb. Use these for
initialization “by parts” (real and imaginary).
the precision used for conversion of midpoints. NULL means
to convert exactly if possible and to round to the global default
precision otherwise; see flintPrec. By convention,
rounding is always towards zero.
Real numbers and real and imaginary parts of complex numbers are
rounded according to the precision set by prec, always in the
direction of zero. Ball midpoints are the numbers obtained by
rounding. Ball radii are upper bounds on the absolute errors incurred
by rounding.
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, recursively, each of
a and b have the format
"(km+/-r)", defining a ball for each of the
real and imaginary parts. k and m define
the sign and absolute value of the signed ball midpoints, and
r defines the unsigned ball radii. k can
be empty if the ball midpoint is NaN or non-negative.
s and t are unary or binary plus or minus
to be reconciled with k; they are optional except in the
third format where t is mandatory.
The sequences km and r are converted
using function mpfr_strtofr from the GNU
MPFR library with argument base set to 0; see
https://www.mpfr.org/mpfr-current/mpfr.html#Assignment-Functions.
.xData, dim, dimnames, namesinherited 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 = "acb"):
equivalent to (but faster than) x == 0.
%*%, crossprod, tcrossprodsignature(x = "acb", y = "acb"):
signature(x = "acb", y = "ANY"):
signature(x = "ANY", y = "acb"):
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.
+signature(e1 = "acb", e2 = "missing"):
returns a copy of the argument.
-signature(e1 = "acb", e2 = "missing"):
returns the negation of the argument.
Complexsignature(z = "acb"):
mathematical functions of one argument; see
S4groupGeneric.
Mathsignature(x = "acb"):
mathematical functions of one argument; see
S4groupGeneric. Member functions
floor, ceiling, trunc, cummin,
cummax are not implemented.
Math2signature(x = "acb"):
decimal rounding according to a second argument digits; see
S4groupGeneric. There are just two member
member functions: round, signif.
Opssignature(e1 = "acb", e2 = "acb"):
signature(e1 = "acb", e2 = "ANY"):
signature(e1 = "ANY", e2 = "acb"):
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.
Summarysignature(x = "acb"):
univariate summary statistics; see
S4groupGeneric. The return value is a
logical vector of length 1 (any, all) or an
acb vector of length 1 or 2 (sum, prod).
Member functions min, max, range are not
implemented.
anyNAsignature(x = "acb"):
returns TRUE if any element of x has real or
imaginary part with midpoint NaN, FALSE otherwise.
as.vectorsignature(x = "acb"):
returns as.vector(y, mode), where y is a complex
vector containing the result of converting the midpoints of 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 a midpoint exceeds .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.
backsolvesignature(r = "acb", x = "acb"):
signature(r = "acb", x = "ANY"):
signature(r = "ANY", x = "acb"):
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.
cholsignature(x = "acb"):
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).
chol2invsignature(x = "acb"):
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).
coercesignature(from = "ANY", to = "acb"):
returns the value of acb(from).
colSums, colMeanssignature(x = "acb"):
returns an acb vector or array containing the column sums
or means of x, defined as sums or means over dimensions
1:dims.
detsignature(x = "arb"):
returns the determinant of x as an acb vector of
length 1.
determinantsignature(x = "acf"):
returns a list with components modulus and argument
specifying the determinant of x, following the documented
behaviour of the base function (except for the use of
argument instead of sign).
diffsignature(x = "acb"):
returns a vector storing lagged differences of the elements of
x or (if x is a matrix) a matrix storing lagged
differences of the rows of x, following the documented
behaviour of the S3 default method.
diffinvsignature(x = "acb"):
returns the vector or matrix y such that
x = diff(y, ...), following the documented behaviour of
the S3 default method.
formatsignature(x = "acb"):
returns a character vector suitable for printing, using string
format "(m +/- r)+(m +/- r)i" and scientific format for
each m and r. Optional arguments control the
output; see format-methods.
is.finitesignature(x = "acb"):
returns a logical vector indicating which elements of x
do not have real or imaginary part with midpoint NaN,
-Inf, or Inf or radius Inf.
is.infinitesignature(x = "acb"):
returns a logical vector indicating which elements of x
have real or imaginary part with midpoint -Inf or
Inf or radius Inf.
is.na, is.nansignature(x = "acb"):
returns a logical vector indicating which elements of x
have real or imaginary part with midpoint NaN.
is.unsortedsignature(x = "acb"):
signals an error indicating that <= is not a total order
on the range of arb; see xtfrm below.
logsignature(x = "acb"):
returns the logarithm of the argument. The natural logarithm is
computed by default (when optional argument base is
unset).
meansignature(x = "acb"):
returns the arithmetic mean.
rowSums, rowMeanssignature(x = "acb"):
returns an acb vector or array containing the row sums or
means of x, defined as sums or means over dimensions
(dims+1):length(dim(x)).
solvesignature(a = "acb", b = "acb"):
signature(a = "acb", b = "ANY"):
signature(a = "ANY", b = "acb"):
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.
xtfrmsignature(x = "acb"):
signals an error indicating that <= is not a total order
on the range of arb: a <= b || b <= a is is not
TRUE for all finite a and b of class
arb. Thus, direct sorting of acb, which is based
on arb, is not supported. Users wanting to order the
midpoints of the real and imaginary parts should operate on
Mid(Real(x)) and
Mid(Imag(x)).
The class generator function has six distinct usages:
acb()
acb(length=)
acb(x)
acb(x, length=)
acb(real=, imag=)
acb(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 arb(real) and
arb(imag) to separately initialize the real and
imaginary parts of the acb return value.
Attempts to recycle real, imag, or x of length
zero to nonzero length are an error.
Usage of acb.array is modelled after array.
The FLINT documentation of the underlying C type: https://flintlib.org/doc/acb.html
Johansson, F. (2017). Arb: efficient arbitrary-precision midpoint-radius interval arithmetic. IEEE Transactions on Computers, 66(8), 1281-1292. tools:::Rd_expr_doi("10.1109/TC.2017.2690633")
Virtual class flint. Generic functions
Real and Imag and their replacement forms
for getting and setting real and imaginary parts.
showClass("acb")
showMethods(classes = "acb")
Run the code above in your browser using DataLab