]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MINICERN/mathlib/gen/v/corset.F
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / mathlib / gen / v / corset.F
CommitLineData
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)
11C Correlated Gaussian random number package
12C
13C CORSET sets up the generation
14C CORGEN actually generates a set of NP random numbers
15C Gaussian-distributed with covariance matrix V
16C and mean values zero.
17C
18C NP is dimension of vectors and matrices
19C V(NP,NP) is covariance matrix
20C C(NP,NP) is working space used internally to hold the
21C 'square root' of V
22C X(NP) is the vector of random numbers generated by CORGEN
23C
24 DIMENSION V(NP,NP), C(NP,NP)
25C
26C Compute C = square root of matrix V
27 DO 40 J=1,NP
28C 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))
33C
34C 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
42C
43 RETURN
44 END