next up previous index
Next: V130 Random Three-Dimensional Up: CERNLIB Previous: V120 Gaussian-distributed Random

V122 Correlated Gaussian-distributed Random Numbers

Routine ID: V122
Author(s): F. JamesLibrary: MATHLIB
Submitter: Submitted: 15.03.1994
Language: FortranRevised:

CORGEN generates vectors of single-precision random numbers in a Gaussian distribution of mean zero and covariance matrix V. The generator must first be set up by a call to CORSET which transforms the covariance matrix V to an appropriate square root matrix C which is then used by CORGEN. CORGEN uses the Gaussian generator RNORML (V120) underneath, which in turn uses the uniform generator RANMAR (V113) underneath, so initialization is performed as in V113, but beware that this also initializes both RANMAR and RNORML! The code is portable Fortran, but the results are not guaranteed to be identical on all platforms as explained in RNORML (V120).

Structure:

SUBROUTINE Subprograms
User Entry Names: CORSET, CORGEN

Usage:

    DIMENSION V(n,n), C(n,n), X(n)
    CALL CORSET(V,C,n)
    DO ...
      CALL CORGEN(C,X,n)
The call to CORSET transforms covariance matrix V to C. The call to CORGEN uses C to generate vector X of correlated Gaussian variables with covariance matrix V.

The limitation n ≤100 is imposed by the dimension of an intermediate storage vector in CORSET.

Note that CORSET takes longer than CORGEN (for medium to large matrices). If it is desired to generate numbers according to a few different matrices, then each pair Vi, Ci must be separately dimensioned and saved as long as it is needed.

Method:

The square root method seems to be an old one whose origins are not known to the author (Ref. 1, p. 1182).

References:

  1. F. James, Monte Carlo theory and practice, Rep. Prog. Phys. 43 (1980) 1145--1189.

V130



next up previous index
Next: V130 Random Three-Dimensional Up: CERNLIB Previous: V120 Gaussian-distributed Random


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995