-
Notifications
You must be signed in to change notification settings - Fork 10
/
say.f90
198 lines (189 loc) · 4.77 KB
/
say.f90
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
module say_lib
interface saynnz
module procedure saynnz_d2,saynnz_d3,saynnz_z2,saynnz_z3
end interface
interface say
module procedure say_d1,say_z1, say_s2,say_d2,say_z2, say_d3, say_i2,say_i3
end interface
contains
subroutine say_d1(a)
implicit none
double precision,intent(in) :: a(:)
character(len=*),parameter :: subnam='say_d1'
integer :: n, i,j
character(len=32) :: frm
n=size(a,1)
do i=1,n
write(*,'(e22.12)') a(i)
end do
return
end subroutine
subroutine say_z1(a)
implicit none
complex(8),intent(in) :: a(:)
character(len=*),parameter :: subnam='say_z1'
integer :: n, i,j
character(len=32) :: frm
n=size(a,1)
do i=1,n
write(*,'(e22.12,1x,e22.12)') a(i)
end do
return
end subroutine
subroutine say_s2(a)
implicit none
real,intent(in) :: a(:,:)
character(len=*),parameter :: subnam='say_s2'
integer :: m,n, i,j
character(len=32) :: frm
m=size(a,1); n=size(a,2)
write(frm,'(a,i4,a)') '(a,',n,'(f7.4,1x),a)'
!write(*,*)'frm: ',frm
do i=1,m
write(*,fmt=frm) '[ ',(a(i,j),j=1,n),']'
end do
return
end subroutine
subroutine say_d2(a)
implicit none
double precision,intent(in) :: a(:,:)
character(len=*),parameter :: subnam='say_d2'
integer :: m,n, i,j
character(len=32) :: frm
m=size(a,1); n=size(a,2)
write(frm,'(a,i4,a)') '(a,',n,'(e9.3,1x),a)'
!write(*,*)'frm: ',frm
do i=1,m
write(*,fmt=frm) '[ ',(a(i,j),j=1,n),']'
end do
return
end subroutine
subroutine say_z2(a)
implicit none
complex(8),intent(in) :: a(:,:)
character(len=*),parameter :: subnam='say_z2'
integer :: m,n, i,j
character(len=64) :: frm
m=size(a,1); n=size(a,2)
write(frm,'(a,i4,a)') '(a,',n,'(e9.3,1x,e9.3,2x),a)'
!write(*,*)'frm: ',frm
do i=1,m
write(*,fmt=frm) '[ ',(a(i,j),j=1,n),']'
end do
return
end subroutine
subroutine say_d3(a)
implicit none
double precision,intent(in) :: a(:,:,:)
integer :: m,n,p, i,j,k
character(len=*),parameter :: subnam='say_d3'
character(len=32) :: frm
m=size(a,1); n=size(a,2); p=size(a,3)
!write(*,*)subnam,':',m,n,p
!write(frm,'(a,i3,a)') '(a,',n,'(e9.3,1x),a)'
write(frm,'(a,i3,a)') '(a,',n,'(f4.1,1x),a)'
! !write(*,*)'frm: ',frm
! do k=1,p
! do i=1,m
! write(*,fmt=frm) '[ ',(a(i,j,k),j=1,n),']'
! end do
! write(*,*)
! end do
do i=1,m
do k=1,p
write(*,fmt=frm) '[ ',(a(i,j,k),j=1,n),']'
end do
write(*,*)
end do
return
end subroutine
subroutine say_i2(a)
implicit none
integer,intent(in) :: a(:,:)
integer :: m,n, i,j
character(len=*),parameter :: subnam='say_i2'
character(len=32) :: frm
m=size(a,1); n=size(a,2)
write(frm,'(a,i3,a)') '(a,',n,'(i2,1x),a)'
do i=1,m
write(*,fmt=frm) '[ ',(a(i,j),j=1,n),']'
end do
return
end subroutine
subroutine say_i3(a)
implicit none
integer,intent(in) :: a(:,:,:)
integer :: m,n,p, i,j,k
character(len=*),parameter :: subnam='say_i3'
character(len=32) :: frm
m=size(a,1); n=size(a,2); p=size(a,3)
write(frm,'(a,i3,a)') '(a,',n,'(i2,1x),a)'
do k=1,p
do i=1,m
write(*,fmt=frm) '[ ',(a(i,j,k),j=1,n),']'
end do
write(*,*)
end do
return
end subroutine
subroutine saynnz_d2(x,tol)
implicit none
double precision,intent(in) :: x(:,:)
double precision,intent(in),optional :: tol
double precision :: eps,nrm
integer :: i,j
if(present(tol))then;eps=tol;else;eps=1.d-13;endif
nrm=maxval(abs(x));eps=eps*nrm
do j=1,size(x,2)
do i=1,size(x,1)
if(dabs(x(i,j)).gt.eps)write(*,'(a,2i6,a,e12.5)')'(',i,j,') ',x(i,j)
enddo
enddo
end subroutine
subroutine saynnz_d3(x,tol)
implicit none
double precision,intent(in) :: x(:,:,:)
double precision,intent(in),optional :: tol
double precision :: eps,nrm
integer :: i,j,k
if(present(tol))then;eps=tol;else;eps=1.d-13;endif
nrm=maxval(abs(x));eps=eps*nrm
do k=1,size(x,3)
do j=1,size(x,2)
do i=1,size(x,1)
if(dabs(x(i,j,k)).gt.eps)write(*,'(a,3i6,a,e12.5)')'(',i,j,k,') ',x(i,j,k)
enddo
enddo
enddo
end subroutine
subroutine saynnz_z2(x,tol)
implicit none
complex(8),intent(in) :: x(:,:)
double precision,intent(in),optional :: tol
double precision :: eps,nrm
integer :: i,j
if(present(tol))then;eps=tol;else;eps=1.d-13;endif
nrm=maxval(abs(x));eps=eps*nrm
do j=1,size(x,2)
do i=1,size(x,1)
if(abs(x(i,j)).gt.eps)write(*,'(a,2i6,a,2e12.5)')'(',i,j,') ',x(i,j)
enddo
enddo
end subroutine
subroutine saynnz_z3(x,tol)
implicit none
complex(8),intent(in) :: x(:,:,:)
double precision,intent(in),optional :: tol
double precision :: eps,nrm
integer :: i,j,k
if(present(tol))then;eps=tol;else;eps=1.d-13;endif
nrm=maxval(abs(x));eps=eps*nrm
do k=1,size(x,3)
do j=1,size(x,2)
do i=1,size(x,1)
if(abs(x(i,j,k)).gt.eps)write(*,'(a,3i6,a,2e12.5)')'(',i,j,k,') ',x(i,j,k)
enddo
enddo
enddo
end subroutine
end module