4
5
6
7
8
9
10
11
12 CHARACTER SYMM, UPLO
13 INTEGER BWL, BWU, IA, IASEED, IBSEED,
14 $ IX, JA, JX, N, NRHS, WORKSIZ
15 DOUBLE PRECISION ANORM, RESID
16
17
18 INTEGER DESCA( * ), DESCX( * )
19 COMPLEX*16 A( * ), WORK( * ), X( * )
20
21 LOGICAL LSAME
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 COMPLEX*16 ZERO, ONE
162 parameter( one = ( 1.0d+0, 0.0d+0 ),
163 $ zero = ( 0.0d+0, 0.0d+0 ) )
164 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
165 $ LLD_, MB_, M_, NB_, N_, RSRC_
166 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
167 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
168 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
169 INTEGER INT_ONE
170 parameter( int_one = 1 )
171
172
173 INTEGER IACOL, IAROW, ICTXT,
174 $ IIA, IIX, IPB, IPW,
175 $ IXCOL, IXROW, J, JJA, JJX, LDA,
176 $ MYCOL, MYROW, NB, NP, NPCOL, NPROW, NQ
177 INTEGER I, START
178 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
179 DOUBLE PRECISION DIVISOR, EPS, RESID1, NORMX
180
181
182
183
184 EXTERNAL blacs_gridinfo, dgebr2d, dgebs2d,
186 $
pzmatgen, zgamx2d, zgemm, zgsum2d,
187 $ zlaset
188
189
190 INTEGER IZAMAX, NUMROC
191 DOUBLE PRECISION PDLAMCH
193
194
195 INTRINSIC abs, dble,
max,
min, mod
196
197
198
199
200
201 ictxt = desca( ctxt_ )
202 nb = desca( nb_ )
203
204 IF(
lsame( symm,
'H' ) )
THEN
205 bw = bwl
206 start = 1
207 work_min =
max(5,nb)+2*nb
208 ELSE
210 IF(
lsame( uplo,
'D' ))
THEN
211 start = 1
212 ELSE
213 start = 2
214 ENDIF
215 work_min =
max(5,nb)+2*nb
216 ENDIF
217
218 IF ( worksiz .LT. work_min ) THEN
219 CALL pxerbla( ictxt,
'PZTLASCHK', -18 )
220 RETURN
221 END IF
222
223 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
224
226 resid = 0.0d+0
227 divisor = anorm * eps * dble( n )
228
229 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
230 $ iarow, iacol )
231 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
232 $ ixrow, ixcol )
233 np =
numroc( (2), desca( mb_ ), myrow, 0, nprow )
234 nq =
numroc( n, desca( nb_ ), mycol, 0, npcol )
235
236 ipb = 1
237 ipproduct = 1 + desca( nb_ )
238 ipw = 1 + 2*desca( nb_ )
239
240 lda = desca( lld_ )
241
242
243
244 IF(
lsame( symm,
'H' ))
THEN
245 CALL pzbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
246 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
247 $ iaseed, myrow, mycol, nprow, npcol )
248 ELSE
249
250 CALL pzbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
251 $ desca( mb_ ), desca( nb_ ), a,
252 $ desca( lld_ ), 0, 0, iaseed, myrow,
253 $ mycol, nprow, npcol )
254 ENDIF
255 IF(
lsame( uplo,
'U' ) )
THEN
256
257
258
259
260
261
262
263 IF( mycol.LT.npcol-1 ) THEN
264 CALL zgesd2d( ictxt, 1, 1,
265 $ a( start+( desca( nb_ )-1 )*lda ),
266 $ lda, myrow, mycol+1 )
267 ENDIF
268
269
270
271 DO 230 i=desca( nb_ )-1,0,-1
272 a( start+(i+1)*lda ) = a( start+(i)*lda )
273 230 CONTINUE
274
275
276
277 IF( mycol.GT.0 ) THEN
278 CALL zgerv2d( ictxt, 1, 1, a( start), lda,
279 $ myrow, mycol-1 )
280 ENDIF
281
282 ENDIF
283
284
285
286 resid = 0.0
287
288 DO 40 j = 1, nrhs
289
290
291
292
293 CALL pzpbdcmv( bw+1, bw, uplo, n, a, 1, desca,
294 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
295 $ work( ipproduct ), work( ipw ), (bw+2)*bw, info )
296
297
298
299
300 CALL pzmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
301 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
302 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
303 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
304 $ myrow, npcol, nprow )
305
306
307
308 CALL pzaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
309 $ work( ipb ), 1, 1, descx, 1 )
310
311 CALL pdznrm2( n, normx,
312 $ x, 1, j, descx, 1 )
313
314 CALL pdznrm2( n, resid1,
315 $ work( ipb ), 1, 1, descx, 1 )
316
317
318
319
320 resid1 = resid1 / ( normx*divisor )
321
322 resid =
max( resid, resid1 )
323
324 40 CONTINUE
325
326 RETURN
327
328
329
subroutine pzmatgen(ictxt, aform, diag, m, n, mb, nb, a, lda, iarow, iacol, iseed, iroff, irnum, icoff, icnum, myrow, mycol, nprow, npcol)
subroutine infog2l(grindx, gcindx, desc, nprow, npcol, myrow, mycol, lrindx, lcindx, rsrc, csrc)
integer function numroc(n, nb, iproc, isrcproc, nprocs)
subroutine pbztran(icontxt, adist, trans, m, n, nb, a, lda, beta, c, ldc, iarow, iacol, icrow, iccol, work)
double precision function pdlamch(ictxt, cmach)
subroutine pxerbla(ictxt, srname, info)
subroutine pzbmatgen(ictxt, aform, aform2, bwl, bwu, n, mb, nb, a, lda, iarow, iacol, iseed, myrow, mycol, nprow, npcol)
subroutine pzpbdcmv(ldbw, bw, uplo, n, a, ja, desca, nrhs, b, ib, descb, x, work, lwork, info)