NAG FL Interface
g05ykf (quasi_​lognormal)

Settings help

FL Name Style:


FL Specification Language:


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

Fortran Interface
Subroutine g05ykf ( xmean, std, n, quas, iref, ifail)
Integer, Intent (In) :: n
Integer, Intent (Inout) :: iref(*), ifail
Real (Kind=nag_wp), Intent (In) :: xmean(*), std(*)
Real (Kind=nag_wp), Intent (Inout) :: quas(n,*)
C Header Interface
#include <nag.h>
void  g05ykf_ (const double xmean[], const double std[], const Integer *n, double quas[], Integer iref[], Integer *ifail)
The routine may be called by the names g05ykf or nagf_rand_quasi_lognormal.

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 Arguments

Note: the following variables are used in the parameter descriptions:
1: xmean(*) Real (Kind=nag_wp) array Input
Note: the dimension of the array xmean must be at least idim.
On entry: specifies, for each dimension, the mean of the underlying Normal distribution.
Constraint: |xmean(i)| | - log(x02amf) -10.0×std(i)| , for i=1,2,,idim.
2: std(*) Real (Kind=nag_wp) array Input
Note: the dimension of the array std must be at least idim.
On entry: specifies, for each dimension, the standard deviation of the underlying Normal distribution.
Constraint: std(i)0.0, for i=1,2,,idim.
3: n Integer Input
On entry: the number of quasi-random numbers required.
Constraint: n0 and n+previous number of generated values231-1.
4: quas(n,*) Real (Kind=nag_wp) array Output
Note: the second dimension of the array quas must be at least idim.
On exit: contains the n quasi-random numbers of dimension idim.
5: 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.
6: 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=1
On entry, iref has either not been initialized or has been corrupted.
ifail=2
On entry, n=value.
Constraint: n0.
ifail=3
On entry, i=value and std(i)=value.
Constraint: std(i)0.
ifail=4
There have been too many calls to the generator.
ifail=5
On entry, i=value and xmean(i)=value.
Constraint: |xmean(i)|value.
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

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)