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 g05ylforg05ynf.
The routine may be called by the names g05ymf or nagf_rand_quasi_uniform.
3Description
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 with high uniformity in the -dimensional unit cube .
Let be a subset of and define the counting function as the number of points . For each , let be the rectangular -dimensional region
with volume . 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 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).
4References
Bratley P and Fox B L (1988) Algorithm 659: implementing Sobol's quasirandom sequence generator ACM Trans. Math. Software14(1) 88–100
Fox B L (1986) Algorithm 647: implementation and relative efficiency of quasirandom sequence generators ACM Trans. Math. Software12(4) 362–376
5Arguments
Note: the following variables are used in the parameter descriptions:
, the number of dimensions required, see g05ylforg05ynf
, the length of iref as supplied to the initialization routine g05ylforg05ynf
1: – IntegerInput
On entry: the number of quasi-random numbers required.
Constraint:
and .
2: – IntegerInput
On entry: the order in which the generated values are returned.
Constraint:
or .
3: – Real (Kind=nag_wp) arrayOutput
Note: the second dimension of the array quas
must be at least
if and at least if .
On exit: contains the n quasi-random numbers of dimension idim.
If , holds the th value for the th dimension.
If , holds the th value for the th dimension.
4: – IntegerInput
On entry: the first dimension of the array quas as declared in the (sub)program from which g05ymf is called.
Constraints:
if , ;
if , .
5: – Integer arrayCommunication Array
Note: the dimension of the array iref
must be at least
.
On entry: contains information on the current state of the sequence.
On exit: contains updated information on the state of the sequence.
6: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
Constraint: .
On entry, value of n would result in too many calls to the generator: , generator has previously been called times.
On entry, .
Constraint: or .
On entry, , .
Constraint: if , .
On entry, and .
Constraint: if , .
On entry, iref has either not been initialized or has been corrupted.
On entry, the specified dimensions are out of sync.
A different number of values have been generated from at least one of the specified dimensions.
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
Not applicable.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
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 . The Faure generator is serial.
9Further Comments
None.
10Example
This example calls g05ylfandg05ymf to estimate the value of the integral
In this example the number of dimensions is set to .