]>
Commit | Line | Data |
---|---|---|
fe4da5cc | 1 | * |
2 | * $Id$ | |
3 | * | |
4 | * $Log$ | |
5 | * Revision 1.1.1.1 1996/04/01 15:02:56 mclareni | |
6 | * Mathlib gen | |
7 | * | |
8 | * | |
9 | #include "gen/pilot.h" | |
10 | SUBROUTINE CORSET (V,C,NP) | |
11 | C Correlated Gaussian random number package | |
12 | C | |
13 | C CORSET sets up the generation | |
14 | C CORGEN actually generates a set of NP random numbers | |
15 | C Gaussian-distributed with covariance matrix V | |
16 | C and mean values zero. | |
17 | C | |
18 | C NP is dimension of vectors and matrices | |
19 | C V(NP,NP) is covariance matrix | |
20 | C C(NP,NP) is working space used internally to hold the | |
21 | C 'square root' of V | |
22 | C X(NP) is the vector of random numbers generated by CORGEN | |
23 | C | |
24 | DIMENSION V(NP,NP), C(NP,NP) | |
25 | C | |
26 | C Compute C = square root of matrix V | |
27 | DO 40 J=1,NP | |
28 | C Diagonal terms | |
29 | CK = 0. | |
30 | DO 10 K= 1, J-1 | |
31 | 10 CK = CK + C(J,K)*C(J,K) | |
32 | C(J,J) = SQRT(ABS(V(J,J) - CK)) | |
33 | C | |
34 | C Off-diagonal terms | |
35 | DO 30 I= J+1, NP | |
36 | CK = 0. | |
37 | DO 20 K= 1, J-1 | |
38 | 20 CK = CK + C(I,K)*C(J,K) | |
39 | C(I,J) = (V(I,J) - CK) /C(J,J) | |
40 | 30 CONTINUE | |
41 | 40 CONTINUE | |
42 | C | |
43 | RETURN | |
44 | END |