Author(s): F. James | Library: MATHLIB |
Submitter: | Submitted: 15.03.1994 |
Language: Fortran | Revised: |
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 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: