NAG Library Function Document
To generate multidimensional quasi-random sequences with a uniform probability distribution.
||nag_quasi_random_uniform (Nag_QuasiRandom_State state,
Low discrepancy (quasi-random) sequences are used in numerical integration, simulation and optimization. Like pseudorandom numbers they are uniformly distributed but they are not statistically independent, rather they are designed to give more even distribution in multidimensional space (uniformity). Therefore they are often more efficient than pseudorandom numbers in multidimensional Monte–Carlo methods.
nag_quasi_random_uniform (g05yac) generates a set of points
with high uniformity in the
-dimensional unit cube
. One measure of the uniformity is the discrepancy which is defined as follows:
nag_quasi_random_uniform (g05yac) generates the low-discrepancy sequences proposed by Sobol, Faure and Niederreiter.
Bratley P and Fox B L (1988) Algorithm 659: implementing Sobol's quasirandom sequence generator ACM Trans. Math. Software 14(1) 88–100
Fox B L (1986) Algorithm 647: implementation and relative efficiency of quasirandom sequence generators ACM Trans. Math. Software 12(4) 362–376
state – Nag_QuasiRandom_StateInput
: the type of operation to perform.
- The first call for initialization, and there is no output via array quasi.
- The sequence has been initialized by a prior call to nag_quasi_random_uniform (g05yac) with . Random numbers are output via array quasi.
- The final call to release memory, and no further random numbers are required for output via array quasi.
, or .
seq – Nag_QuasiRandom_SequenceInput
: the type of sequence to generate.
- A Sobol sequence.
- A Niederreiter sequence.
- A Faure sequence.
, or .
iskip – IntegerInput
: the number of terms in the sequence to skip on initialization.
- All the terms of the sequence are generated.
- The first terms of the sequence are ignored and the first term of the sequence now corresponds to the th term of the sequence when .
is not referenced.
if or and , .
idim – IntegerInput
the number of dimensions required.
quasi[idim] – doubleOutput
: the random numbers.
If , contains the random number for the th dimension.
gf – Nag_QuasiRandom *Communication Structure
Workspace used to communicate information between calls to nag_quasi_random_uniform (g05yac). The contents of this structure should not be changed between calls.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
On entry, seq
is not valid:
On entry, .
On entry, .
On entry, .
On entry, value of skip too large: .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG
Too many calls to generator.
The maximum length of the generated sequences is
, this should be adequate for practical purposes. In the case of the Niederreiter generator nag_quasi_random_uniform (g05yac) jumps to the appropriate starting point, while for the Sobol generator it simply steps through the sequence. In consequence the Sobol generator with large values of iskip
will take a significant amount of time.
This example approximates the integral
is the number of dimensions.
9.1 Program Text
Program Text (g05yace.c)
9.2 Program Data
9.3 Program Results
Program Results (g05yace.r)