to_array {qrng} | R Documentation |
Converting higher-dimensional matrices of quasi-random numbers to arrays of specific formats.
to_array(x, f, format = c("(n*f,d)", "(n,f,d)"))
x |
(n,fd)-matrix of quasi-random numbers to be converted. |
f |
factor f >= 1 dividing |
format |
|
to_array()
is helpful for converting quasi-random numbers
to time series paths.
(n * f, d)-matrix
or (n, f, d)-array
depending on the chosen format
.
Marius Hofert
korobov()
, ghalton()
, sobol()
.
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))