NAG Library Routine Document

g05ymf  (quasi_uniform)

 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

Fortran Interface
Subroutine g05ymf ( n, rcord, quas, ldquas, iref, ifail)
Integer, Intent (In):: n, rcord, ldquas
Integer, Intent (Inout):: iref(liref), ifail
Real (Kind=nag_wp), Intent (Inout):: quas(ldquas,tdquas)
C Header Interface
#include nagmk26.h
void  g05ymf_ ( const Integer *n, const Integer *rcord, double quas[], const Integer *ldquas, Integer iref[], Integer *ifail)

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
Arguments

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:     quasldquastdquas – 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.
Constraints:
  • if rcord=1, ldquasidim;
  • if rcord=2, ldquasn.
5:     irefliref – 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 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, n=value.
Constraint: n0.
On entry, value of n would result in too many calls to the generator: n=value, generator has previously been called value times.
ifail=2
On entry, rcord=value.
Constraint: rcord=1 or 2.
ifail=4
On entry, ldquas=value, idim=value.
Constraint: if rcord=1, ldquasidim.
On entry, ldquas=value and n=value.
Constraint: if rcord=2, ldquasn.
ifail=5
On entry, iref has either not been initialized or has been corrupted.
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

g05ymf 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.
The Sobol, Sobol (A659) and Niederreiter quasi-random number generators in g05ymf have been parallelized, but require quite large problem sizes to see any significant performance gain. Parallelism is only enabled when rcord=2. The Faure generator is serial.

9
Further Comments

None.

10
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.

10.1
Program Text

Program Text (g05ymfe.f90)

10.2
Program Data

Program Data (g05ymfe.d)

10.3
Program Results

Program Results (g05ymfe.r)

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