NAG Library Function Document
nag_quasi_rand_uniform (g05ymc) generates a uniformly distributed low-discrepancy sequence as proposed by Sobol, Faure or Niederreiter. It must be preceded by a call to one of the initialization functions nag_quasi_init (g05ylc)
or nag_quasi_init_scrambled (g05ync)
||nag_quasi_rand_uniform (Nag_OrderType order,
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_rand_uniform (g05ymc) generates a set of points with high uniformity in the -dimensional unit cube .
be a subset of
and define the counting function
as the number of points
. For each
be the rectangular
. Then one measure of the uniformity of the points
is the discrepancy:
which has the form
The principal aim in the construction of low-discrepancy sequences is to find sequences of points in with a bound of this form where the constant is as small as possible.
The type of low-discrepancy sequence generated by nag_quasi_rand_uniform (g05ymc) depends on the initialization function called and can include those proposed by Sobol, Faure or Niederreiter. If the initialization function nag_quasi_init_scrambled (g05ync)
was used then the sequence will be scrambled (see Section 3
in nag_quasi_init_scrambled (g05ync) for details).
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
the following variables are used in the parameter descriptions:
order – Nag_OrderTypeInput
: the order
argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by
. See Section 126.96.36.199
in the Essential Introduction for a more detailed explanation of the use of this argument.
n – IntegerInput
the number of quasi-random numbers required.
quas – doubleOutput
appears in this document, it refers to the array element
- when ;
- when .
holds the th value for the th dimension.
pdquas – IntegerInput
: the stride separating row or column elements (depending on the value of order
) in the array quas
- if , ;
- if , .
iref – IntegerCommunication Array
On entry: contains information on the current state of the sequence.
On exit: contains updated information on the state of the sequence.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
On entry, argument had an illegal value.
On entry, iref
has either not been initialized or has been corrupted.
On entry, .
On entry, , .
Constraint: if , .
On entry, and .
Constraint: if , .
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
On entry, value of n
would result in too many calls to the generator:
, generator has previously been called
This example calls nag_quasi_init (g05ylc)
and nag_quasi_rand_uniform (g05ymc) to estimate the value of the integral
In this example the number of dimensions is set to .
9.1 Program Text
Program Text (g05ymce.c)
9.2 Program Data
9.3 Program Results
Program Results (g05ymce.r)