]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MINICERN/mathlib/gen/g/tkolmo.F
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / MINICERN / mathlib / gen / g / tkolmo.F
CommitLineData
fe4da5cc 1*
2* $Id$
3*
4* $Log$
5* Revision 1.1.1.1 1996/04/01 15:02:42 mclareni
6* Mathlib gen
7*
8*
9#include "gen/pilot.h"
10 SUBROUTINE TKOLMO(A,NA,B,NB,PROB)
11*==========>
12* Tests whether two one-dimensional sets of points
13* are compatible with coming from the same parent
14* distribution, using the Kolmogorov test
15* A is the vector of NA points in set one.
16* B is the vector of NB points in set two.
17* PROB is the probability of compatibility returned to
18* the calling program.
19*
20* F. James, April, 1987
21*==========>
22*
23 DIMENSION A(NA),B(NB)
24* In case of an error, PROB is returned as -1.
25 PROB = -1.0
26* Require at least two points in each set
27 IF (NA.LE.2 .OR. NB.LE.2) GO TO 99
28* Constants needed
29 RNA = REAL(NA)
30 RNB = REAL(NB)
31 SA = 1.0/RNA
32 SB = 1.0/RNB
33* Starting values for main loop
34 IF (A(1) .LT. B(1)) THEN
35 RDIFF = -SA
36 IA = 2
37 IB = 1
38 ELSE
39 RDIFF = SB
40 IB = 2
41 IA = 1
42 ENDIF
43 RDMAX = ABS(RDIFF)
44*
45* Main loop over point sets to find max distance
46* RDIFF is the running difference, and RDMAX the max.
47 DO 10 I= 1, NA+NB
48 IF (A(IA) .LT. B(IB)) THEN
49 RDIFF = RDIFF - SA
50 IA = IA + 1
51 IF (IA .GT. NA) GO TO 20
52 ELSE
53 RDIFF = RDIFF + SB
54 IB = IB + 1
55 IF (IB .GT. NB) GO TO 20
56 ENDIF
57 RDMAX = MAX(RDMAX,ABS(RDIFF))
58 10 CONTINUE
59* Should never terminate this loop!
60 GO TO 99
61 20 RDMAX = MAX(RDMAX,ABS(RDIFF))
62 Z = RDMAX * SQRT(RNA*RNB/(RNA+RNB))
63 PROB = PROBKL(Z)
64*
65 99 CONTINUE
66 END