Last change
on this file since 10099 was 286, checked in by harald, 25 years ago |
This is the start point for further developments of the Magic Monte Carlo
Simulation written by Jose Carlos Gonzales. Now it is under control of
one CVS repository for the whole collaboration. Everyone should use this
CVS repository for further developments.
|
File size:
1.5 KB
|
Line | |
---|
1 | SUBROUTINE FLPSOR(A,N)
|
---|
2 |
|
---|
3 | C-----------------------------------------------------------------------
|
---|
4 | C CERN PROGLIB# M103 FLPSOR .VERSION KERNFOR 3.15 820113
|
---|
5 | C ORIG. 29/04/78
|
---|
6 | C-----------------------------------------------------------------------
|
---|
7 | C SORT THE ONE-DIMENSIONAL FLOATING POINT ARRAY A(1),...,A(N) BY
|
---|
8 | C INCREASING VALUES
|
---|
9 | C
|
---|
10 | C PROGRAM M103 TAKEN FROM CERN PROGRAM LIBRARY, 29-APR-78
|
---|
11 | C-----------------------------------------------------------------------
|
---|
12 |
|
---|
13 | DIMENSION A(*)
|
---|
14 | COMMON /SLATE/ LT(20),RT(20)
|
---|
15 | INTEGER R,RT
|
---|
16 | C-----------------------------------------------------------------------
|
---|
17 |
|
---|
18 | LEVEL=1
|
---|
19 | LT(1)=1
|
---|
20 | RT(1)=N
|
---|
21 | 10 L=LT(LEVEL)
|
---|
22 | R=RT(LEVEL)
|
---|
23 | LEVEL=LEVEL-1
|
---|
24 | 20 IF(R.GT.L) GO TO 200
|
---|
25 | IF(LEVEL) 50,50,10
|
---|
26 | C
|
---|
27 | C SUBDIVIDE THE INTERVAL L,R
|
---|
28 | C L : LOWER LIMIT OF THE INTERVAL (INPUT)
|
---|
29 | C R : UPPER LIMIT OF THE INTERVAL (INPUT)
|
---|
30 | C J : UPPER LIMIT OF LOWER SUB-INTERVAL (OUTPUT)
|
---|
31 | C I : LOWER LIMIT OF UPPER SUB-INTERVAL (OUTPUT)
|
---|
32 | C
|
---|
33 | 200 I=L
|
---|
34 | J=R
|
---|
35 | M=(L+R)/2
|
---|
36 | X=A(M)
|
---|
37 | 220 IF(A(I).GE.X) GO TO 230
|
---|
38 | I=I+1
|
---|
39 | GO TO 220
|
---|
40 | 230 IF(A(J).LE.X) GO TO 231
|
---|
41 | J=J-1
|
---|
42 | GO TO 230
|
---|
43 | C
|
---|
44 | 231 IF(I.GT.J) GO TO 232
|
---|
45 | W=A(I)
|
---|
46 | A(I)=A(J)
|
---|
47 | A(J)=W
|
---|
48 | I=I+1
|
---|
49 | J=J-1
|
---|
50 | IF(I.LE.J) GO TO 220
|
---|
51 | C
|
---|
52 | 232 LEVEL=LEVEL+1
|
---|
53 | IF((R-I).GE.(J-L)) GO TO 30
|
---|
54 | LT(LEVEL)=L
|
---|
55 | RT(LEVEL)=J
|
---|
56 | L=I
|
---|
57 | GO TO 20
|
---|
58 | 30 LT(LEVEL)=I
|
---|
59 | RT(LEVEL)=R
|
---|
60 | R=J
|
---|
61 | GO TO 20
|
---|
62 | 50 RETURN
|
---|
63 | END
|
---|
Note:
See
TracBrowser
for help on using the repository browser.