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

NAG Library Routine Document

G05YKF

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

G05YKF generates a quasi-random sequence from a log-normal distribution. It must be preceded by a call to one of the initialization routines G05YLF or G05YNF.

2  Specification

SUBROUTINE G05YKF ( XMEAN, STD, N, QUAS, IREF, IFAIL)
INTEGER  N, IREF(liref), IFAIL
REAL (KIND=nag_wp)  XMEAN(idim), STD(idim), QUAS(N,idim)

3  Description

G05YKF generates a quasi-random sequence from a log-normal distribution by first generating a uniform quasi-random sequence which is then transformed into a log-normal sequence using the exponential of the inverse of the Normal CDF. The type of uniform sequence used depends on the initialization routine called and can include the low-discrepancy sequences proposed by Sobol, Faure or Niederreiter. If the initialization routine G05YNF was used then the underlying uniform sequence is first scrambled prior to being transformed (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
Wichura (1988) Algorithm AS 241: the percentage points of the Normal distribution Appl. Statist. 37 477–484

5  Parameters

Note: the following variables are used in the parameter descriptions:
1:     XMEANidim – REAL (KIND=nag_wp) arrayInput
On entry: specifies, for each dimension, the mean of the underlying Normal distribution.
Constraint: XMEANi - logX02AMF -10.0× STDi , for i=1,2,,idim.
2:     STDidim – REAL (KIND=nag_wp) arrayInput
On entry: specifies, for each dimension, the standard deviation of the underlying Normal distribution.
Constraint: STDi0.0, for i=1,2,,idim.
3:     N – INTEGERInput
On entry: the number of quasi-random numbers required.
Constraint: N0 and N+previous number of generated values231-1.
4:     QUASNidim – REAL (KIND=nag_wp) arrayOutput
On exit: contains the N quasi-random numbers of dimension idim.
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 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:
IFAIL=1
On entry, incorrect initialization has been detected.
IFAIL=2
On entry,N<1.
IFAIL=3
On entry,at least one element of XMEAN is too large.
IFAIL=4
There have been too many calls to the generator.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

G05YKF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G05YKF 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.
The Sobol, Sobol (A659) and Niederreiter quasi-random number generators in g05ykc have been parallelized, but require quite large problem sizes to see any significant performance gain. The Faure generator is serial.

9  Further Comments

None.

10  Example

This example calls G05YLF to initialize the generator and then G05YKF to produce a sequence of five four-dimensional quasi-random numbers variates.

10.1  Program Text

Program Text (g05ykfe.f90)

10.2  Program Data

Program Data (g05ykfe.d)

10.3  Program Results

Program Results (g05ykfe.r)


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

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