# NAG CL Interfaceg05ylc (quasi_​init)

Settings help

CL Name Style:

## 1Purpose

g05ylc initializes a quasi-random generator prior to calling g05yjc, g05ykc or g05ymc.

## 2Specification

 #include
 void g05ylc (Nag_QuasiRandom_Sequence genid, Integer idim, Integer iref[], Integer liref, Integer iskip, NagError *fail)
The function may be called by the names: g05ylc, nag_rand_quasi_init or nag_quasi_init.

## 3Description

g05ylc selects a quasi-random number generator through the input value of genid and initializes the iref communication array for use by the functions g05yjc, g05ykc or g05ymc.
One of three types of quasi-random generator may be chosen, allowing the low-discrepancy sequences proposed by Sobol, Faure or Niederreiter to be generated.
Two sets of Sobol sequences are supplied, the first, is based on the work of Joe and Kuo (2008). The second, referred to in the documentation as "Sobol (A659)", is based on Algorithm 659 of Bratley and Fox (1988) with the extension to 1111 dimensions proposed by Joe and Kuo (2003). Both sets of Sobol sequences should satisfy the so-called Property A, up to $1111$ dimensions, but the first set should have better two-dimensional projections than those produced using Algorithm 659.

## 4References

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
Joe S and Kuo F Y (2003) Remark on Algorithm 659: implementing Sobol's quasirandom sequence generator ACM Trans. Math. Software (TOMS) 29 49–57
Joe S and Kuo F Y (2008) Constructing Sobol sequences with better two-dimensional projections SIAM J. Sci. Comput. 30 2635–2654

## 5Arguments

1: $\mathbf{genid}$Nag_QuasiRandom_Sequence Input
On entry: must identify the quasi-random generator to use.
${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Sobol}$
Sobol generator.
${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_SobolA659}$
Sobol (A659) generator.
${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Nied}$
Niederreiter generator.
${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Faure}$
Faure generator.
Constraint: ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Sobol}$, $\mathrm{Nag_QuasiRandom_SobolA659}$, $\mathrm{Nag_QuasiRandom_Nied}$ or $\mathrm{Nag_QuasiRandom_Faure}$.
2: $\mathbf{idim}$Integer Input
On entry: the number of dimensions required.
Constraints:
• if ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Sobol}$, $1\le {\mathbf{idim}}\le 10000$;
• if ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_SobolA659}$, $1\le {\mathbf{idim}}\le 1111$;
• if ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Nied}$, $1\le {\mathbf{idim}}\le 318$;
• if ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Faure}$, $1\le {\mathbf{idim}}\le 40$.
3: $\mathbf{iref}\left[{\mathbf{liref}}\right]$Integer Communication Array
On exit: contains initialization information for use by the generator functions g05yjc, g05ykc and g05ymc. iref must not be altered in any way between initialization and calls of the generator functions.
4: $\mathbf{liref}$Integer Input
On entry: the dimension of the array iref.
Constraints:
• if ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Sobol}$, $\mathrm{Nag_QuasiRandom_SobolA659}$ or $\mathrm{Nag_QuasiRandom_Nied}$, ${\mathbf{liref}}\ge 32×{\mathbf{idim}}+7$;
• if ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Faure}$, ${\mathbf{liref}}\ge 407$.
5: $\mathbf{iskip}$Integer Input
On entry: the number of terms of the sequence to skip on initialization for the Sobol and Niederreiter generators. If ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Faure}$, iskip is ignored.
Constraint: if ${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Sobol}$, $\mathrm{Nag_QuasiRandom_SobolA659}$ or $\mathrm{Nag_QuasiRandom_Nied}$, $0\le {\mathbf{iskip}}\le {2}^{30}$.
6: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{idim}}=⟨\mathit{\text{value}}⟩$.
Constraint: $1\le {\mathbf{idim}}\le ⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{iskip}}<0$ or iskip is too large: ${\mathbf{iskip}}=⟨\mathit{\text{value}}⟩$, maximum value is $⟨\mathit{\text{value}}⟩$.
On entry, liref is too small: ${\mathbf{liref}}=⟨\mathit{\text{value}}⟩$, minimum length is $⟨\mathit{\text{value}}⟩$.
NE_INTERNAL_ERROR
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 for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

Not applicable.

## 8Parallelism and Performance

g05ylc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The primitive polynomials and direction numbers used for the Sobol generator (${\mathbf{genid}}=\mathrm{Nag_QuasiRandom_Sobol}$) were calculated by Joe and Kuo (2008) using the search critera ${D}^{\left(6\right)}$.