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 DOUBLE PRECISION 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 DOUBLE PRECISION ZERO, ONE
162 parameter( one = 1.0d+0, zero = 0.0d+0 )
163 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
164 $ LLD_, MB_, M_, NB_, N_, RSRC_
165 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
166 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
167 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
168 INTEGER INT_ONE
169 parameter( int_one = 1 )
170
171
172 INTEGER IACOL, IAROW, ICTXT,
173 $ IIA, IIX, IPB, IPW,
174 $ IXCOL, IXROW, J, JJA, JJX, LDA,
175 $ MYCOL, MYROW, NB, NP, NPCOL, NPROW, NQ
176 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
177 DOUBLE PRECISION DIVISOR, EPS, RESID1, NORMX
178
179
180
181
182 EXTERNAL blacs_gridinfo, dgamx2d, dgebr2d,
183 $ dgebs2d, dgemm, dgerv2d, dgesd2d,
185
186
187 INTEGER IDAMAX, NUMROC
188 DOUBLE PRECISION PDLAMCH
190
191
192 INTRINSIC abs, dble,
max,
min, mod
193
194
195
196
197
198 ictxt = desca( ctxt_ )
199 nb = desca( nb_ )
200
201 IF(
lsame( symm,
'S' ) )
THEN
202 bw = bwl
203 work_min =
max(5,
max(bw*(bw+2),nb))+2*nb
204 ELSE
206 work_min =
max(5,
max(bw*(bw+2),nb))+2*nb
207 ENDIF
208
209 IF ( worksiz .LT. work_min ) THEN
210 CALL pxerbla( ictxt,
'PDBLASCHK', -18 )
211 RETURN
212 END IF
213
214 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
215
217 resid = 0.0d+0
218 divisor = anorm * eps * dble( n )
219
220 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
221 $ iarow, iacol )
222 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
223 $ ixrow, ixcol )
224 np =
numroc( (bw+1), desca( mb_ ), myrow, 0, nprow )
225 nq =
numroc( n, desca( nb_ ), mycol, 0, npcol )
226
227 ipb = 1
228 ipproduct = 1 + desca( nb_ )
229 ipw = 1 + 2*desca( nb_ )
230
231 lda = desca( lld_ )
232
233
234
235 IF(
lsame( symm,
'S' ))
THEN
236 CALL pdbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
237 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
238 $ iaseed, myrow, mycol, nprow, npcol )
239 ELSE
240
241 CALL pdbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
242 $ desca( mb_ ), desca( nb_ ), a,
243 $ desca( lld_ ), 0, 0, iaseed, myrow,
244 $ mycol, nprow, npcol )
245 ENDIF
246
247
248
249 resid = 0.0
250
251 DO 40 j = 1, nrhs
252
253
254
255
256 CALL pdpbdcmv( bw+1, bw, uplo, n, a, 1, desca,
257 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
258 $ work( ipproduct ), work( ipw ), (bw+2)*bw, info )
259
260
261
262
263 CALL pdmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
264 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
265 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
266 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
267 $ myrow, npcol, nprow )
268
269
270
271 CALL pdaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
272 $ work( ipb ), 1, 1, descx, 1 )
273
274 CALL pdnrm2( n, normx,
275 $ x, 1, j, descx, 1 )
276
277 CALL pdnrm2( n, resid1,
278 $ work( ipb ), 1, 1, descx, 1 )
279
280
281
282
283 resid1 = resid1 / ( normx*divisor )
284
285 resid =
max( resid, resid1 )
286
287 40 CONTINUE
288
289 RETURN
290
291
292
subroutine pdmatgen(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 pbdtran(icontxt, adist, trans, m, n, nb, a, lda, beta, c, ldc, iarow, iacol, icrow, iccol, work)
double precision function pdlamch(ictxt, cmach)
subroutine pdbmatgen(ictxt, aform, aform2, bwl, bwu, n, mb, nb, a, lda, iarow, iacol, iseed, myrow, mycol, nprow, npcol)
subroutine pdpbdcmv(ldbw, bw, uplo, n, a, ja, desca, nrhs, b, ib, descb, x, work, lwork, info)
subroutine pxerbla(ictxt, srname, info)