Class fmpz
extends virtual class flint
.
It represents vectors of arbitrary precision signed integers. There
is no representation for R's missing value
NA_integer_
.
## Class generator functionsfmpz(x = 0L, length = 0L, names = NULL)
fmpz.array(x = 0L, dim = length(x), dimnames = NULL)
An fmpz
vector, possibly an array; see ‘Details’.
an atomic or flint
vector containing data for
conversion to fmpz
.
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.
Real numbers and real parts of complex numbers are rounded in the direction of 0. Imaginary parts of complex numbers are discarded.
Character strings are converted using function mpz_set_str
from
the GNU MP library with argument base
set
to 0; see https://gmplib.org/manual/Assigning-Integers.
An error is signaled if elements of x
are NaN
,
-Inf
, or Inf
.
.xData
, dim
, dimnames
, names
inherited from virtual class flint
.
!
signature(x = "fmpz")
:
equivalent to (but faster than) x == 0
.
%*%
, crossprod
, tcrossprod
signature(x = "fmpz", y = "fmpz")
:
signature(x = "fmpz", y = "ANY")
:
signature(x = "ANY", y = "fmpz")
:
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 = "fmpz", e2 = "missing")
:
returns a copy of the argument.
-
signature(e1 = "fmpz", e2 = "missing")
:
returns the negation of the argument.
Complex
signature(z = "fmpz")
:
mathematical functions of one argument; see
S4groupGeneric
. Member functions requiring
promotion to a floating-point type may not be implemented.
Math
signature(x = "fmpz")
:
mathematical functions of one argument; see
S4groupGeneric
. Member functions requiring
promotion to a floating-point type may not be implemented.
Math2
signature(x = "fmpz")
:
decimal rounding according to a second argument digits
; see
S4groupGeneric
. There are just two member
member functions: round
, signif
.
Ops
signature(e1 = "fmpz", e2 = "fmpz")
:
signature(e1 = "fmpz", e2 = "ANY")
:
signature(e1 = "ANY", e2 = "fmpz")
:
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 = "fmpz")
:
univariate summary statistics; see
S4groupGeneric
. The return value is a
logical vector of length 1 (any
, all
) or an
fmpz
vector of length 1 or 2 (sum
, prod
,
min
, max
, range
).
anyNA
signature(x = "fmpz")
:
returns FALSE
, as fmpz
has no representation for
NaN
.
as.vector
signature(x = "fmpz")
:
returns as.vector(y, mode)
, where y
is a double
vector containing the result of converting each element 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 in the direction of zero,
unless the element 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
.
backsolve
signature(r = "fmpz", x = "fmpz")
:
signature(r = "fmpz", x = "ANY")
:
signature(r = "ANY", x = "fmpz")
:
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.
If r
and (if not missing) x
are both formally
rational, then the solution is exact and the return value is an
fmpq
matrix.
chol
signature(x = "fmpz")
:
coerces x
to class arf
and
dispatches.
chol2inv
signature(x = "fmpz")
:
returns the inverse of the positive definite matrix whose upper
triangular Cholesky factor is the upper triangular part of
x
. The return value is the exact inverse, being computed
as tcrossprod(backsolve(x))
.
coerce
signature(from = "ANY", to = "fmpz")
:
returns the value of fmpz(from)
.
colSums
signature(x = "fmpz")
:
returns an fmpz
vector or array containing the column sums
of x
, defined as sums over dimensions 1:dims
.
colMeans
signature(x = "fmpz")
:
returns an fmpq
vector or array containing
the column means of x
, defined as means over dimensions
1:dims
.
det
signature(x = "fmpz")
:
returns the determinant of x
as an fmpz
vector of
length 1.
determinant
signature(x = "fmpz")
:
returns a list with components modulus
and sign
specifying the determinant of x
, following the base
function, hence see determinant
. Note that
det(x)
and determinant(x, logarithm = FALSE)
are
exact, but determinant(x)
is not in general due to
rounding.
format
signature(x = "fmpz")
:
returns a character vector suitable for printing. Optional
arguments control the output; see format-methods
.
is.finite
returns a logical vector whose elements are all TRUE
, as
fmpz
has no representation for NaN
, -Inf
, and
Inf
.
is.infinite
, is.na
, is.nan
signature(x = "fmpz")
:
returns a logical vector whose elements are all FALSE
, as
fmpz
has no representation for NaN
, -Inf
, and
Inf
.
is.unsorted
signature(x = "fmpz")
:
returns a logical indicating if x
is not sorted in
nondecreasing order (increasing order if optional argument
strictly
is set to TRUE
).
mean
signature(x = "fmpz")
:
returns the arithmetic mean. An error is signaled if the argument
length is 0, because the return type is fmpq
which cannot represent the result of division by 0.
rowSums
signature(x = "fmpz")
:
returns an fmpz
vector or array containing the row sums of
x
, defined as sums over dimensions
(dims+1):length(dim(x))
.
rowMeans
signature(x = "fmpz")
:
returns an fmpq
vector or array containing
the row means of x
, defined as means over dimensions
(dims+1):length(dim(x))
.
solve
signature(a = "fmpz", b = "fmpz")
:
signature(a = "fmpz", b = "ANY")
:
signature(a = "ANY", b = "fmpz")
:
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. If a
and
(if not missing) b
are both formally rational, then the
solution is exact and the return value is an
fmpq
matrix.
The class generator function has four distinct usages:
fmpz()
fmpz(length=)
fmpz(x)
fmpz(x, 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. Attempts to recycle x
of length zero to nonzero length
are an error.
Usage of fmpz.array
is modelled after array
.
The FLINT documentation of the underlying C type: https://flintlib.org/doc/fmpz.html
Virtual class flint
.
showClass("fmpz")
showMethods(classes = "fmpz")
Run the code above in your browser using DataLab