to_array: Compute Matrices to Arrays

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/auxiliaries.R

Description

Converting higher-dimensional matrices of quasi-random numbers to arrays of specific formats.

Usage

1
to_array(x, f, format = c("(n*f,d)", "(n,f,d)"))

Arguments

x

(n,fd)-matrix of quasi-random numbers to be converted.

f

factor f >= 1 dividing ncol{x}.

format

character string indicating the output format to which x should be converted.

Details

to_array() is helpful for converting quasi-random numbers to time series paths.

Value

(n * f, d)-matrix or (n, f, d)-array depending on the chosen format.

Author(s)

Marius Hofert

See Also

korobov(), ghalton(), sobol().

Examples

1
2
3
4
5
6
7
N <- 4 # replications
n <- 3 # time steps
d <- 2 # dimension
set.seed(271) # note: respected for the choice of 'randomize'
x <- sobol(N, d = n * d, randomize = "digital.shift") # higher-dim. Sobol'
stopifnot(dim(to_array(x, f = n)) == c(N * n, d)) # conversion and check
stopifnot(dim(to_array(x, f = n, format = "(n,f,d)")) == c(N, n, d))

qrng documentation built on Nov. 26, 2020, 5:08 p.m.

Related to to_array in qrng...