Part function

Get or Set One Part of a Vector

Get or Set One Part of a Vector

The subclasses of virtual class flint are interfaces to types in the FLINT

library. For types implemented recursively as 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. methods

Num(q) Num(q) <- value Den(q) Den(q) <- value Mid(x) Mid(x) <- value Rad(x) Rad(x) <- value Real(z) Real(z) <- value Imag(z) Imag(z) <- value

Arguments

  • q: a vector-like object with elements representing quotients of numbers. Package flint provides methods for class fmpq.
  • x: a vector-like object with elements representing balls in a metric space. Package flint provides methods for class arb.
  • z: a vector-like object with elements representing complex numbers. Package flint provides methods for classes acf and acb.
  • value: a vector-like 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").

Returns

Num, Den, Mid, Rad, Real, and Imag return a vector-like object of length matching the argument. The replacement forms return a vector-like 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.

Details

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).

See Also

Virtual class flint.

Examples

(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)
  • Maintainer: Mikael Jagan
  • License: GPL (>= 2)
  • Last published: 2025-03-24