NAG Library Routine Document

g05ylf (quasi_init)

1
Purpose

g05ylf initializes a quasi-random generator prior to calling g05yjf, g05ykf or g05ymf.

2
Specification

Fortran Interface
Subroutine g05ylf ( genid, idim, iref, liref, iskip, ifail)
Integer, Intent (In):: genid, idim, liref, iskip
Integer, Intent (Inout):: iref(liref), ifail
C Header Interface
#include <nagmk26.h>
void  g05ylf_ (const Integer *genid, const Integer *idim, Integer iref[], const Integer *liref, const Integer *iskip, Integer *ifail)

3
Description

g05ylf selects a quasi-random number generator through the input value of genid and initializes the iref communication array for use by the routines g05yjf, g05ykf or g05ymf.
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.

4
References

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

5
Arguments

1:     genid – IntegerInput
On entry: must identify the quasi-random generator to use.
genid=1
Sobol generator.
genid=2
Sobol (A659) generator.
genid=3
Niederreiter generator.
genid=4
Faure generator.
Constraint: genid=1, 2, 3 or 4.
2:     idim – IntegerInput
On entry: the number of dimensions required.
Constraints:
  • if genid=1, 1idim10000;
  • if genid=2, 1idim1111;
  • if genid=3, 1idim318;
  • if genid=4, 1idim40.
3:     irefliref – Integer arrayCommunication Array
On exit: contains initialization information for use by the generator routines g05yjf, g05ykf and g05ymf. iref must not be altered in any way between initialization and calls of the generator routines.
4:     liref – IntegerInput
On entry: the dimension of the array iref as declared in the (sub)program from which g05ylf is called.
Constraints:
  • if genid=1, 2 or 3, liref32×idim+7;
  • if genid=4, liref407.
5:     iskip – IntegerInput
On entry: the number of terms of the sequence to skip on initialization for the Sobol and Niederreiter generators. If genid=4, iskip is ignored.
Constraint: if genid=1, 2 or 3, 0iskip230.
6:     ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, genid=value.
Constraint: genid=1, 2, 3 or 4.
ifail=2
On entry, idim=value.
Constraint: 1idimvalue.
ifail=4
On entry, liref is too small: liref=value, minimum length is value.
ifail=5
On entry, iskip<0 or iskip is too large: iskip=value, maximum value is value.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Not applicable.

8
Parallelism and Performance

g05ylf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

The primitive polynomials and direction numbers used for the Sobol generator (genid=1) were calculated by Joe and Kuo (2008) using the search critera D6.

10
Example

See Section 10 in g05ymf.