Mercurial > hg > octave-lyh
annotate libcruft/ranlib/gennor.f @ 10535:3f973f6c841c
improve sparse concatenation operator
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 20 Apr 2010 08:42:03 +0200 |
parents | 0e71ead7359d |
children |
rev | line source |
---|---|
2329 | 1 REAL FUNCTION gennor(av,sd) |
2 C********************************************************************** | |
3 C | |
4 C REAL FUNCTION GENNOR( AV, SD ) | |
5 C | |
6 C GENerate random deviate from a NORmal distribution | |
7 C | |
8 C | |
9 C Function | |
10 C | |
11 C | |
12 C Generates a single random deviate from a normal distribution | |
13 C with mean, AV, and standard deviation, SD. | |
14 C | |
15 C | |
16 C Arguments | |
17 C | |
18 C | |
19 C AV --> Mean of the normal distribution. | |
20 C REAL AV | |
21 C | |
22 C SD --> Standard deviation of the normal distribution. | |
23 C REAL SD | |
3188 | 24 C JJV (SD >= 0) |
2329 | 25 C |
26 C GENNOR <-- Generated normal deviate. | |
27 C REAL GENNOR | |
28 C | |
29 C | |
30 C Method | |
31 C | |
32 C | |
33 C Renames SNORM from TOMS as slightly modified by BWB to use RANF | |
34 C instead of SUNIF. | |
35 C | |
36 C For details see: | |
37 C Ahrens, J.H. and Dieter, U. | |
38 C Extensions of Forsythe's Method for Random | |
39 C Sampling from the Normal Distribution. | |
40 C Math. Comput., 27,124 (Oct. 1973), 927 - 937. | |
41 C | |
42 C | |
43 C********************************************************************** | |
44 C .. Scalar Arguments .. | |
45 REAL av,sd | |
46 C .. | |
47 C .. External Functions .. | |
48 REAL snorm | |
49 EXTERNAL snorm | |
50 C .. | |
51 C .. Executable Statements .. | |
3188 | 52 C JJV added check to ensure SD >= 0.0 |
53 IF (sd.GE.0.0) GO TO 10 | |
54 WRITE (*,*) 'SD < 0.0 in GENNOR - ABORT' | |
55 WRITE (*,*) 'Value of SD: ',sd | |
10103
0e71ead7359d
Use CALL XSTOPX instead of STOP in Fortran ranlib routines
Rik <rdrider0-list@yahoo.com>
parents:
3188
diff
changeset
|
56 CALL XSTOPX ('SD < 0.0 in GENNOR - ABORT') |
3188 | 57 |
58 10 gennor = sd*snorm() + av | |
2329 | 59 RETURN |
60 | |
61 END |