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.
## The class generator function:
.acb(...)## Mode 1: initialize with zeros
## .acb(length = 0L)
##
## Mode 2: initialize with vector
## .acb(length = length(x), x)
##
## Mode 3: initialize by parts
## .acb(length = max0(length(real), length(imag)), real, imag)
##
## where max0 <- function(m, n) if (min(m, n)) max(m, n) else 0L
The class generator function returns new("acb", ...)
.
arguments passed to methods for initialize
.
.xData
, 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 = "acb")
:
equivalent to (but faster than) x == 0
.
+
signature(e1 = "acb", e2 = "missing")
:
returns a copy of the argument.
-
signature(e1 = "acb", e2 = "missing")
:
returns the negation of the argument.
Complex
signature(z = "acb")
:
mathematical functions of one argument; see
S4groupGeneric
.
Math
signature(x = "acb")
:
mathematical functions of one argument; see
S4groupGeneric
. Member functions
floor
, ceiling
, trunc
, cummin
,
cummax
are not implemented.
Math2
signature(x = "acb")
:
decimal rounding according to a second argument digits
; see
S4groupGeneric
. There are just two member
member functions: round
, signif
.
Ops
signature(e1 = "ANY", e2 = "acb")
:
signature(e1 = "acb", 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 = "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.
anyNA
signature(x = "acb")
:
returns TRUE
if any element of x
has real or
imaginary part with midpoint NaN
, FALSE
otherwise.
as.vector
signature(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.
coerce
signature(from = "ANY", to = "acb")
:
returns .acb(x = from)
. An error is signaled if the class
or type of from
is not supported by the method for
initialize
.
format
signature(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
.
initialize
signature(.Object = "acb", 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 (zero midpoint, zero radius in the
real and imaginary parts). .Object
is not copied, so all
references are affected.
initialize
signature(.Object = "acb", 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 = "acb", 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
arb
and recycled as necessary.
is.finite
signature(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.infinite
signature(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.nan
signature(x = "acb")
:
returns a logical vector indicating which elements of x
have real or imaginary part with midpoint NaN
.
is.unsorted
signature(x = "acb")
:
signals an error indicating that <=
is not a total order
on the range of arb
; see xtfrm
below.
log
signature(x = "acb")
:
returns the logarithm of the argument. The natural logarithm is
computed by default (when optional argument base
is
unset).
mean
signature(x = "acb")
:
returns the arithmetic mean.
xtfrm
signature(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 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