-
Notifications
You must be signed in to change notification settings - Fork 0
/
piksr3.dem.f
48 lines (48 loc) · 1.41 KB
/
piksr3.dem.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
PROGRAM D8R2
C Driver for routine PIKSR3
use piksrt_dim, only : DIV,FMT,I,J,X,A,piksr3,read_file,iFMT
implicit none
integer B,C
real Br,Cr
DIMENSION B(X),C(X),Br(X),Cr(X)
call read_file
C Generate B and C arrays
DO I=1,X
B(I)=I
C(I)=(int(A(I))+B(I))/2
enddo
C Sort A and mix B,C
Br=real(B)
Cr=real(C)
CALL PIKSR3(X,A,Br,Cr)
WRITE(*,*) 'After sorting A and mixing B and C, array A is:'
DO I=1,X/DIV
WRITE(*,FMT) (A(DIV*(I-1)+J), J=1,DIV)
enddo
WRITE(*,*) '...and array B is:'
DO I=1,X/DIV
WRITE(*,iFMT) (B(DIV*(I-1)+J), J=1,DIV)
enddo
WRITE(*,*) '...and array C is:'
DO I=1,X/DIV
WRITE(*,iFMT) (C(DIV*(I-1)+J), J=1,DIV)
enddo
WRITE(*,*) 'press RETURN to continue...'
READ(*,*)
C Sort B and mix A,C
Br=real(B)
Cr=real(C)
CALL PIKSR3(X,Br,A,Cr)
WRITE(*,*) 'After sorting B and mixing A and C, array A is:'
DO I=1,X/DIV
WRITE(*,FMT) (A(DIV*(I-1)+J), J=1,DIV)
enddo
WRITE(*,*) '...and array B is:'
DO I=1,X/DIV
WRITE(*,iFMT) (B(DIV*(I-1)+J), J=1,DIV)
enddo
WRITE(*,*) '...and array C is:'
DO I=1,X/DIV
WRITE(*,iFMT) (C(DIV*(I-1)+J), J=1,DIV)
enddo
END