Qrng: Quasi-random sequences

QrngR Documentation

Quasi-random sequences

Description

Quasi-random sequences as per the Gnu Scientific Library, reference manual section 18. These functions are declared in header file gsl_qrng.h

Usage

qrng_alloc(type = c("niederreiter_2", "sobol"), dim)
qrng_clone(q)
qrng_init(q)
qrng_name(q)
qrng_size(q)
qrng_get(q, n = 1)

Arguments

type

Type of sequence

dim

Dimension of sequence

q

Generator from qrng_alloc or qrng_clone

n

How many vectors to generate

Details

These are wrappers for the quasi-random sequence functions from the GSL https://www.gnu.org/software/gsl/ with arguments corresponding to those from the library, with a few exceptions. In particular: I have used dim where the GSL uses just d; I have added the n argument to the qrng_get function, so that a single call can generate n vectors; I have not provided R functions corresponding to qrng_free (because R will automatically free the generator when it is garbage collected) or qrng_state or qrng_memcpy (because these don't make sense within R.)

Value

qrng_alloc, qrng_clone and qrng_init return an external pointer to the C structure representing the generator. The internals of this structure are not accessible from within R.

qrng_name returns a character vector giving the name of the generator.

qrng_size returns an integer value giving the internal memory usage of the generator.

qrng_get returns a matrix with n rows and dim columns. Each row is a vector in the quasi-random sequence.

Author(s)

Duncan Murdoch

References

https://www.gnu.org/software/gsl/

Examples

q <- qrng_alloc(dim = 2)
qrng_name(q)
qrng_get(q, 10)

RobinHankin/gsl documentation built on Sept. 12, 2023, 7:02 a.m.