1 : C ISHELI SOURCE CHAT 05/01/13 00:43:58 5004
2 : SUBROUTINE ISHELI(NL,LIST,NK,KEY,
3 : $ IMPR,IRET)
4 : IMPLICIT INTEGER(I-N)
5 : IMPLICIT REAL*8 (A-H,O-Z)
6 : C***********************************************************************
7 : C NOM : ISHELI
8 : C DESCRIPTION : Order a list of integers in ascending sequence of their
9 : C keys using Shell's method as implemented in Numerical
10 : C Recipes.
11 : C
12 : C LANGAGE : FORTRAN 77 (sauf E/S)
13 : C
14 : C AUTEUR : Scott Sloan
15 : C
16 : C BIBLIO : @Article{,
17 : C author = {S. W. Sloan},
18 : C title = {A Fortran Program for Profile and Wavefront Reduction},
19 : C journal = {International Journal for Numerical Methods in Engineering},
20 : C year = {1989},
21 : C volume = {28},
22 : C pages = {2651-2679}
23 : C}
24 : C@Book{,
25 : C editor = {Cambridge University Press},
26 : C title = {Numerical Recipes in Fortran 77 : the Art of Scientific
27 : C Programming},
28 : C publisher = {Cambridge University Press},
29 : C year = {1986-1992},
30 : C note = {http://www.nr.com}
31 : C}
32 : C
33 : C***********************************************************************
34 : C APPELE PAR : DIAMTR
35 : C***********************************************************************
36 : C ENTREES :
37 : C NL - Length of LIST
38 : C LIST - A list of integers
39 : C NK - Length of KEY (NK must be ge NL)
40 : C KEY - A list of integer keys
41 : C
42 : C SORTIES :
43 : C NL - Unchanged
44 : C LIST - A list of integers sorted in ascending sequence of KEY
45 : C NK - Unchanged
46 : C KEY - Unchanged
47 : C
48 : C NOTES :
49 : C
50 : C Efficient for medium lists only (NL lt 50).
51 : C
52 : C CODE RETOUR (IRET) : = 0 si tout s'est bien passé
53 : C***********************************************************************
54 : C VERSION : v1, 05/11/99, version initiale
55 : C HISTORIQUE : v1, 10/03/89, création
56 : C HISTORIQUE :
57 : C HISTORIQUE :
58 : C***********************************************************************
59 : C Prière de PRENDRE LE TEMPS de compléter les commentaires
60 : C en cas de modification de ce sous-programme afin de faciliter
61 : C la maintenance !
62 : C***********************************************************************
63 : -INC CCOPTIO
64 : INTEGER NL,NK,I,J,T,VALUE,INC
65 : INTEGER LIST(NL),KEY(NK)
66 : INTEGER IMPR,IRET
67 : *
68 : * Executable statements
69 : *
70 : IF (IMPR.GT.1) WRITE(IOIMP,*) 'Entrée dans isheli'
71 : C Determine the starting increment
72 : INC=1
73 : 1 CONTINUE
74 : INC=3*INC+1
75 : IF (INC.LE.NL) GOTO 1
76 : C Loop over the partial sorts
77 : 2 CONTINUE
78 : INC=INC/3
79 : C Outer loop of straight insertion
80 : DO 11 I=INC+1,NL
81 : T=LIST(I)
82 : VALUE=KEY(T)
83 : J=I
84 : C Inner loop of straight insertion
85 : 3 CONTINUE
86 : IF (KEY(LIST(J-INC)).GT.VALUE) THEN
87 : LIST(J)=LIST(J-INC)
88 : J=J-INC
89 : IF (J.LE.INC) GOTO 4
90 : GOTO 3
91 : ENDIF
92 : 4 CONTINUE
93 : LIST(J)=T
94 : 11 CONTINUE
95 : IF (INC.GT.1) GOTO 2
96 : *
97 : * Normal termination
98 : *
99 : IRET=0
100 : RETURN
101 : *
102 : * Format handling
103 : *
104 : *
105 : * Error handling
106 : *
107 : 9999 CONTINUE
108 : IRET=1
109 : WRITE(IOIMP,*) 'An error was detected in subroutine isheli'
110 : RETURN
111 : *
112 : * End of subroutine ISHELI
113 : *
114 : END
115 :
116 :
117 :
© Cast3M 2003 - All rights reserved.
Disclaimer