Learn R Programming

Rmpfr (version 0.1-6)

mpfrArray: Construct "mpfrArray" almost as by 'array()'

Description

Utility to construct an Robject of class mpfrArray, very analogously to the numeric array function.

Usage

mpfrArray(x, precBits, dim = length(x), dimnames = NULL)

Arguments

x
numeric(like) vector, typically of length prod(dim) or shorter in which case it is recycled.
precBits
~~Describe precBits here~~
dim
the dimension of the array to be created, that is a vector of length one or more giving the maximal indices in each dimension.
dimnames
either NULL or the names for the dimensions. This is a list with one component for each dimension, either NULL or a character vector of the length given by dim for that dimension.

Value

  • an object of class "mpfrArray", specifically "mpfrMatrix" when length(dim) == 2.

See Also

mpfr, array.

Examples

Run this code
## preallocating is possible here too
ma <- mpfrArray(NA,   prec = 80, dim = 2:4)
validObject(a2 <- mpfrArray(1:24, prec = 64, dim = 2:4))

## recycles, gives an "mpfrMatrix" and dimnames :
mat <- mpfrArray(1:5, 64, dim = c(5,3), dimnames=list(NULL, letters[1:3]))
mat

Run the code above in your browser using DataLab