-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathprmat.f
executable file
·197 lines (194 loc) · 4.41 KB
/
prmat.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
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
! This file is part of std2.
!
! Copyright (C) 2013-2025 Stefan Grimme and Marc de Wergifosse
!
! std2 is free software: you can redistribute it and/or modify it under
! the terms of the GNU Lesser General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! std2 is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with std2. If not, see <https://www.gnu.org/licenses/>.
!
!! ------------------------------------------------------------------------
SUBROUTINE PRMAT(IUOUT,R,N,M,HEAD)
CHARACTER*(*) HEAD
real*8 R(*)
C SUBROUTINE PRINTS MATRIX R,WHICH IS SUPPOSED
C TO HAVE DIMENSION N,M WHEN M IS NONZERO AND
C ((N+1)*N)/2 WHEN M IS ZERO
WRITE(IUOUT,1001) HEAD
NKPB=8
IF(M)10,10,80
C
10 CONTINUE
IBL=N/NKPB
IR=N-IBL*NKPB
J1=1
K1S=1
KD=0
IF(IBL.EQ.0) GO TO 50
J2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ACTER*(*) HEAD
real*4 R(*)
C SUBROUTINE PRINTS MATRIX R,WHICH IS SUPPOSED
C TO HAVE DIMENSION N,M WHEN M IS NONZERO AND
C ((N+1)*N)/2 WHEN M IS ZERO
WRITE(IUOUT,1001) HEAD
NKPB=8
IF(M)10,10,80
C
10 CONTINUE
IBL=N/NKPB
IR=N-IBL*NKPB
J1=1
K1S=1
KD=0
IF(IBL.EQ.0) GO TO 50
J2=NKPB
DO 40 I=1,IBL
WRITE(IUOUT,1002)(J,J=J1,J2)
K1=K1S
K2=K1
KK=0
DO 20 J=J1,J2
WRITE(IUOUT,1003)J,(R(K),K=K1,K2)
KK=KK+1
K1=K1+KD+KK
20 K2=K1+KK
J1=J1+NKPB
IF(J1.GT.N) RETURN
J2=J2+NKPB
K2=K1-1
K1=K2+1
K2=K1+(NKPB-1)
K1S=K2+1
KK=KD+NKPB
DO 30 J=J1,N
WRITE(IUOUT,1003)J,(R(K),K=K1,K2)
KK=KK+1
K1=K1+KK
30 K2=K2+KK
40 KD=KD+NKPB
50 IF(IR.EQ.0) GO TO 70
K1=K1S
J2=J1+IR-1
KK=0
K2=K1
WRITE(IUOUT,1002)(J,J=J1,J2)
WRITE(IUOUT,1003)
DO 60 J=J1,J2
WRITE(IUOUT,1003)J,(R(K),K=K1,K2)
KK=KK+1
K1=K1+KD+KK
60 K2=K1+KK
70 RETURN
80 IBL=M/NKPB
IR=M-IBL*NKPB
I2=0
K2=0
IF(IBL.EQ.0) GO TO 100
DO 90 I=1,IBL
I1=(I-1)*N*NKPB+1
I2=I1+(NKPB-1)*N
K1=K2+1
K2=K1+(NKPB-1)
WRITE(IUOUT,1002)(K,K=K1,K2)
DO 90 J=1,N
WRITE(IUOUT,1003)J,(R(IJ),IJ=I1,I2,N)
I1=I1+1
90 I2=I1+(NKPB-1)*N
100 IF(IR.EQ.0) GO TO 120
I1=IBL*N*NKPB+1
I2=I1+(IR-1)*N
K1=K2+1
K2=M
WRITE(IUOUT,1002)(K,K=K1,K2)
W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