4
5
6
7
8
9
10
11
12 CHARACTER SYMM, TRANS, UPLO
13 INTEGER BWL, BWU, IA, IASEED, IBSEED,
14 $ IX, JA, JX, N, NRHS, WORKSIZ
15 REAL ANORM, RESID
16
17
18 INTEGER DESCA( * ), DESCX( * )
19 REAL 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
162
163
164 REAL ZERO, ONE
165 parameter( one = 1.0e+0, zero = 0.0e+0 )
166 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
167 $ LLD_, MB_, M_, NB_, N_, RSRC_
168 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
169 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
170 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
171 INTEGER INT_ONE
172 parameter( int_one = 1 )
173
174
175 INTEGER IACOL, IAROW, ICTXT,
176 $ IIA, IIX, IPB, IPW,
177 $ IXCOL, IXROW, J, JJA, JJX, LDA,
178 $ MYCOL, MYROW, NB, NP, NPCOL, NPROW, NQ
179 INTEGER BW, INFO, IPPRODUCT, WORK_MIN
180 REAL DIVISOR, EPS, RESID1, NORMX
181
182
183
184
186 $ sgamx2d, sgebr2d, sgebs2d, sgemm,
187 $ sgerv2d, sgesd2d, sgsum2d, slaset
188
189
190 INTEGER ISAMAX, NUMROC
191 REAL PSLAMCH
193
194
195 INTRINSIC abs,
max,
min, mod, real
196
197
198
199
200
201 ictxt = desca( ctxt_ )
202 nb = desca( nb_ )
203
204 IF(
lsame( symm,
'S' ) )
THEN
205 bw = bwl
206 work_min =
max(5,
max(
max(bwl,bwu)*(
max(bwl,bwu)+2),nb))+2*nb
207 ELSE
209 work_min =
max(5,
max(
max(bwl,bwu)*(
max(bwl,bwu)+2),nb))+2*nb
210 ENDIF
211
212 IF ( worksiz .LT. work_min ) THEN
213 CALL pxerbla( ictxt,
'PSBLASCHK', -18 )
214 RETURN
215 END IF
216
217 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
218
220 resid = 0.0e+0
221 divisor = anorm * eps * real( n )
222
223 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
224 $ iarow, iacol )
225 CALL infog2l( ix, jx, descx, nprow, npcol, myrow, mycol, iix, jjx,
226 $ ixrow, ixcol )
227 np =
numroc( (bwl+bwu+1), desca( mb_ ), myrow, 0, nprow )
228 nq =
numroc( n, desca( nb_ ), mycol, 0, npcol )
229
230 ipb = 1
231 ipproduct = 1 + desca( nb_ )
232 ipw = 1 + 2*desca( nb_ )
233
234 lda = desca( lld_ )
235
236
237
238 IF(
lsame( symm,
'S' ))
THEN
239 CALL psbmatgen( ictxt, uplo,
'D', bw, bw, n, bw+1,
240 $ desca( nb_ ), a, desca( lld_ ), 0, 0,
241 $ iaseed, myrow, mycol, nprow, npcol )
242 ELSE
243
244 CALL psbmatgen( ictxt,
'N', uplo, bwl, bwu, n,
245 $ desca( mb_ ), desca( nb_ ), a,
246 $ desca( lld_ ), 0, 0, iaseed, myrow,
247 $ mycol, nprow, npcol )
248 ENDIF
249
250
251
252 resid = 0.0
253
254 DO 40 j = 1, nrhs
255
256
257
258
259 CALL psgbdcmv( bwl+bwu+1, bwl, bwu, trans, n, a, 1, desca,
260 $ 1, x( 1 + (j-1)*descx( lld_ )), 1, descx,
261 $ work( ipproduct ), work( ipw ),
262 $ (
max(bwl,bwu)+2)*
max(bwl,bwu), info )
263
264
265
266
267 CALL psmatgen( descx( ctxt_ ),
'No',
'No', descx( m_ ),
268 $ descx( n_ ), descx( mb_ ), descx( nb_ ),
269 $ work( ipb ), descx( lld_ ), descx( rsrc_ ),
270 $ descx( csrc_ ), ibseed, 0, nq, j-1, 1, mycol,
271 $ myrow, npcol, nprow )
272
273
274
275 CALL psaxpy( n, -one, work( ipproduct ), 1, 1, descx, 1,
276 $ work( ipb ), 1, 1, descx, 1 )
277
278 CALL psnrm2( n, normx,
279 $ x, 1, j, descx, 1 )
280
281 CALL psnrm2( n, resid1,
282 $ work( ipb ), 1, 1, descx, 1 )
283
284
285
286
287 resid1 = resid1 / ( normx*divisor )
288
289 resid =
max( resid, resid1 )
290
291 40 CONTINUE
292
293 RETURN
294
295
296
subroutine psmatgen(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 pbstran(icontxt, adist, trans, m, n, nb, a, lda, beta, c, ldc, iarow, iacol, icrow, iccol, work)
real function pslamch(ictxt, cmach)
subroutine psbmatgen(ictxt, aform, aform2, bwl, bwu, n, mb, nb, a, lda, iarow, iacol, iseed, myrow, mycol, nprow, npcol)
subroutine psgbdcmv(ldbw, bwl, bwu, trans, n, a, ja, desca, nrhs, b, ib, descb, x, work, lwork, info)
subroutine pxerbla(ictxt, srname, info)