The subclasses of virtual class flint
are
interfaces to C types in the FLINT C
library. For types implemented recursively as C structs,
it is often very natural to get and set the struct members. The
functions documented here provide support for this common operation;
they are all S4 generic.
Num(q)
Num(q) <- value
Den(q)
Den(q) <- valueMid(x)
Mid(x) <- value
Rad(x)
Rad(x) <- value
Real(z)
Real(z) <- value
Imag(z)
Imag(z) <- value
Num
, Den
, Mid
, Rad
, Real
, and
Imag
return a vector-like R object of length matching the
argument. The replacement forms return a vector-like R object of
length matching either the argument or the replacement value; the
class of the result is, if not the class of the argument, then a
superclass. See ‘Details’ for behaviour specific to methods
in package flint.
a vector-like R object with elements representing quotients of
numbers. Package flint provides methods for class
fmpq
.
a vector-like R object with elements representing balls in a
metric space. Package flint provides methods for class
arb
.
a vector-like R object with elements representing complex
numbers. Package flint provides methods for classes
acf
and acb
.
a vector-like R object; the replacement value. Methods in
package flint support atomic vectors and vectors inheriting
from virtual class flint
. They inherit
recycling behaviour from methods for initialize
; see,
e.g., selectMethod("Num<-", "fmpq")
.
Num
and Den
extract fmpz
numerators
and denominators from fmpq
q
. The
replacement form of Num
constructs a new fmpq
vector
from value
(coerced to fmpz
) and Den(q)
. The
replacement form of Den
constructs a new fmpq
vector
from Num(q)
and value
(coerced to fmpz
).
Mid
and Rad
extract arf
midpoints
and mag
radii from arb
x
. The replacement form of Mid
constructs a new
arb
vector from value
(coerced to arf
) and
Rad(x)
. The replacement form of Rad
constructs a new
arb
vector from Mid(x)
and value
(coerced to
mag
).
Real
and Imag
extract arf
real and
imaginary parts from acf
z
and
arb
real and imaginary parts from
acb
z
. The replacement form of
Real
constructs a new acf
or acb
vector from
value
(coerced to arf
or arb
) and Imag(z)
.
The replacement form of Imag
constructs a new acf
or
acb
vector from Real(z)
and value
(coerced to
arf
or arb
).
Virtual class flint
.
(q <- q. <- .fmpq(num = 1:10, den = 2L))
Num(q)
Den(q)
Num(q) <- Den(q)
q
(m <- Num(q))
(n <- Den(q))
stopifnot(m == 1L, n == 1L, q == 1L)
Run the code above in your browser using DataLab