NAG FL Interface
g05ypf (quasi_​uniform_​bydim)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

g05ypf generates a uniformly distributed low-discrepancy sequence as proposed by Sobol or Niederreiter. Values are generated for a subset of dimensions. It must be preceded by a call to one of the initialization routines g05ylf or g05ynf.

2 Specification

Fortran Interface
Subroutine g05ypf ( sorder, n, fdim, ldim, quas, ldquas, iref, ifail)
Integer, Intent (In) :: sorder, n, fdim, ldim, ldquas
Integer, Intent (Inout) :: iref(*), ifail
Real (Kind=nag_wp), Intent (Inout) :: quas(ldquas,*)
C Header Interface
#include <nag.h>
void  g05ypf_ (const Integer *sorder, const Integer *n, const Integer *fdim, const Integer *ldim, double quas[], const Integer *ldquas, Integer iref[], Integer *ifail)
The routine may be called by the names g05ypf or nagf_rand_quasi_uniform_bydim.

3 Description

g05ypf generates a sequence of low discrepancy (quasi-random) values for a specified subset of dimensions. See Section 2.2 in the G05 Chapter Introduction for more details.
Prior to calling this routine one of the initialization routines g05ylf or g05ynf must be called and the type of sequence returned by g05ypf can include the low-discrepancy sequences proposed by Sobol or Niederreiter, depending on the arguments supplied to the initialization routine used. If the initialization routine g05ynf was used then the returned sequence is 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: sorder Integer Input
On entry: the order in which the generated values are returned.
Constraint: sorder=1 or 2.
2: n Integer Input
On entry: the number of quasi-random numbers required.
Constraint: n0 and n+previous number of generated values231-1.
3: fdim Integer Input
On entry: the first dimension to return.
Constraint: 1fdimldim.
4: ldim Integer Input
On entry: the last dimension to return.
Constraint: ldimidim.
5: quas(ldquas,*) Real (Kind=nag_wp) array Output
Note: the second dimension of the array quas must be at least ldim-fdim+1 if sorder=1 and at least n if sorder=2.
On exit: contains the n quasi-random numbers for the required dimensions of a sequence with idim dimensions.
For i=1,2,,n, j=fdim,fdim+1,,ldim the ith value for the jth dimension is held in quas(i,k), where k=j-fdim+1.
6: ldquas Integer Input
On entry: the first dimension of the array quas as declared in the (sub)program from which g05ypf is called.
Constraints:
  • if sorder=1, ldquasn;
  • if sorder=2, ldquasldim-fdim+1.
7: iref(*) Integer array Communication Array
Note: the dimension of the array iref must be at least liref.
On entry: contains information on the current state of the sequence.
On exit: contains updated information on the state of the sequence.
8: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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=11
On entry, sorder=value.
Constraint: sorder=1 or 2.
ifail=21
On entry, n=value.
Constraint: n0.
ifail=22
On entry, value of n would result in too many calls to the generator: n=value, generator has previously been called value times.
ifail=31
On entry, fdim=value and ldim=value.
Constraint: 1fdimldim
ifail=41
On entry, ldim=value and idim=value.
Constraint: ldimidim
ifail=61
On entry, ldquas=value and n=value.
Constraint: ldquasn.
ifail=62
On entry, ldquas=value and ldim-fdim+1=value.
Constraint: ldquasldim-fdim+1.
ifail=81
On entry, iref has either not been initialized or has been corrupted.
ifail=83
On entry, iref is too short to use with g05ypf.
ifail=84
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.
ifail=85
g05ypf can not be used with the Faure generator.
ifail=-99
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.
ifail=-399
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g05ypf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g05ypf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
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

None.

10 Example

This example generates 10 values from dimensions 3 to 7 of an 8 dimension Sobol sequence.

10.1 Program Text

Program Text (g05ypfe.f90)

10.2 Program Data

Program Data (g05ypfe.d)

10.3 Program Results

Program Results (g05ypfe.r)