G05YMF (PDF version)
G05 Chapter Contents
G05 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G05YMF 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 routines G05YLF or G05YNF.

2  Specification

REAL (KIND=nag_wp)  QUAS(LDQUAS,tdquas)

3  Description

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.
G05YMF generates a set of points x1,x2,,xN with high uniformity in the S-dimensional unit cube IS=0,1S.
Let G be a subset of IS and define the counting function SNG as the number of points xiG. For each x=x1,x2,,xSIS, let Gx be the rectangular S-dimensional region
G x = 0, x 1 × 0, x 2 ×× 0, x S
with volume x1,x2,,xS. Then one measure of the uniformity of the points x1,x2,,xN is the discrepancy:
DN* x1,x2,,xN = sup xIS SN Gx - N x1 , x2 , , xS .
which has the form
DN*x1,x2,,xNCSlogNS+OlogNS-1  for all  N2.
The principal aim in the construction of low-discrepancy sequences is to find sequences of points in IS with a bound of this form where the constant CS is as small as possible.
The type of low-discrepancy sequence generated by G05YMF depends on the initialization routine called and can include those proposed by Sobol, Faure or Niederreiter. If the initialization routine G05YNF was used then the sequence will be scrambled (see Section 3 in G05YNF for details).

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

5  Parameters

Note: the following variables are used in the parameter descriptions:
1:     N – INTEGERInput
On entry: the number of quasi-random numbers required.
Constraint: N0 and N+previous number of generated values231-1.
2:     RCORD – INTEGERInput
On entry: the order in which the generated values are returned.
Constraint: RCORD=1 or 2.
3:     QUAS(LDQUAS,tdquas) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the N quasi-random numbers of dimension idim.
If RCORD=1, QUASij holds the jth value for the ith dimension.
If RCORD=2, QUASij holds the ith value for the jth dimension.
4:     LDQUAS – INTEGERInput
On entry: the first dimension of the array QUAS as declared in the (sub)program from which G05YMF is called.
  • if RCORD=1, LDQUASidim;
  • if RCORD=2, LDQUASN.
5:     IREF(liref) – INTEGER arrayCommunication Array
On entry: contains information on the current state of the sequence.
On exit: contains updated information on the state of the sequence.
6:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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 parameter, 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:
On entry, either N<0 or there have been too many calls to the generator.
On entry, RCORD1 or 2.
On entry, RCORD=1 and LDQUAS<idim.
On entry, RCORD=2 and LDQUAS<N.
Incorrect initialization. G05YLF must be called prior to G05YMF and IREF must remain unaltered after this call.

7  Accuracy

Not applicable.

8  Further Comments


9  Example

This example calls G05YLF and G05YMF to estimate the value of the integral
01 01 i=1 s 4xi-2 dx1, dx2, , dxs = 1 .
In this example the number of dimensions S is set to 8.

9.1  Program Text

Program Text (g05ymfe.f90)

9.2  Program Data

Program Data (g05ymfe.d)

9.3  Program Results

Program Results (g05ymfe.r)

G05YMF (PDF version)
G05 Chapter Contents
G05 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012