NAG CL Interface
g05ypc (quasi_​uniform_​bydim)

Settings help

CL Name Style:

1 Purpose

g05ypc 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 functions g05ylc or g05ync.

2 Specification

#include <nag.h>
void  g05ypc (Nag_OrderType order, Integer n, Integer fdim, Integer ldim, double quas[], Integer pdquas, Integer iref[], NagError *fail)
The function may be called by the names: g05ypc or nag_rand_quasi_uniform_bydim.

3 Description

g05ypc 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 function one of the initialization functions g05ylc or g05ync must be called and the type of sequence returned by g05ypc can include the low-discrepancy sequences proposed by Sobol or Niederreiter, depending on the arguments supplied to the initialization routine used. If the initialization function g05ync was used then the returned sequence is scrambled (see Section 3 in g05ync 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: order Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
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[dim] double Output
Note: where QUAS(i,k) appears in this document, it refers to the array element
  • quas[(k-1)×pdquas+i-1] when order=Nag_ColMajor;
  • quas[(i-1)×pdquas+k-1] when order=Nag_RowMajor.
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 and k=j-fdim+1, the ith value for the jth dimension is held in
  • QUAS(i,k), if order=Nag_ColMajor,
  • QUAS(k,i), if order=Nag_RowMajor.
6: pdquas Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array quas.
  • if order=Nag_ColMajor, pdquasn;
  • if order=Nag_RowMajor, pdquasldim-fdim+1.
7: iref[dim] Integer Communication Array
Note: the dimension, dim, 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: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, pdquas=value and ldim-fdim+1=value.
Constraint: pdquasldim-fdim+1.
On entry, pdquas=value and n=value.
Constraint: pdquasn.
On entry, argument value had an illegal value.
g05ypc can not be used with the Faure generator.
On entry, iref has either not been initialized or has been corrupted.
On entry, iref is too short to use with g05ypc.
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.
On entry, ldim=value and idim=value.
Constraint: ldimidim
On entry, n=value.
Constraint: n0.
On entry, fdim=value and ldim=value.
Constraint: 1fdimldim
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL 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 CL Interface for further information.
On entry, value of n would result in too many calls to the generator: n=value, generator has previously been called value times.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g05ypc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g05ypc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments


10 Example

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

10.1 Program Text

Program Text (g05ypce.c)

10.2 Program Data

Program Data (g05ypce.d)

10.3 Program Results

Program Results (g05ypce.r)