153
154
155
156
157
158
159 LOGICAL TSTERR
160 INTEGER NMAX, NN, NOUT, NRHS
161 REAL THRESH
162
163
164 LOGICAL DOTYPE( * )
165 INTEGER IWORK( * ), NVAL( * )
166 REAL RWORK( * )
167 COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
168 $ WORK( * ), X( * ), XACT( * )
169
170
171
172
173
174 REAL ONE, ZERO
175 parameter( one = 1.0e+0, zero = 0.0e+0 )
176 INTEGER NTYPES, NTESTS
177 parameter( ntypes = 10, ntests = 3 )
178 INTEGER NFACT
179 parameter( nfact = 2 )
180
181
182 LOGICAL ZEROT
183 CHARACTER DIST, FACT, TYPE, UPLO, XTYPE
184 CHARACTER*3 MATPATH, PATH
185 INTEGER I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
186 $ IZERO, J, K, KL, KU, LDA, LWORK, MODE, N,
187 $ NB, NBMIN, NERRS, NFAIL, NIMAT, NRUN, NT
188 REAL AINVNM, ANORM, CNDNUM, RCONDC
189
190
191 CHARACTER FACTS( NFACT ), UPLOS( 2 )
192 INTEGER ISEED( 4 ), ISEEDY( 4 )
193 REAL RESULT( NTESTS )
194
195
196
197 REAL CLANHE
199
200
205
206
207 LOGICAL LERR, OK
208 CHARACTER*32 SRNAMT
209 INTEGER INFOT, NUNIT
210
211
212 COMMON / infoc / infot, nunit, ok, lerr
213 COMMON / srnamc / srnamt
214
215
216 INTRINSIC max, min
217
218
219 DATA iseedy / 1988, 1989, 1990, 1991 /
220 DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
221
222
223
224
225
226
227
228 path( 1: 1 ) = 'Complex precision'
229 path( 2: 3 ) = 'HR'
230
231
232
233 matpath( 1: 1 ) = 'Complex precision'
234 matpath( 2: 3 ) = 'HE'
235
236 nrun = 0
237 nfail = 0
238 nerrs = 0
239 DO 10 i = 1, 4
240 iseed( i ) = iseedy( i )
241 10 CONTINUE
242 lwork = max( 2*nmax, nmax*nrhs )
243
244
245
246 IF( tsterr )
247 $
CALL cerrvx( path, nout )
248 infot = 0
249
250
251
252
253 nb = 1
254 nbmin = 2
257
258
259
260 DO 180 in = 1, nn
261 n = nval( in )
262 lda = max( n, 1 )
263 xtype = 'N'
264 nimat = ntypes
265 IF( n.LE.0 )
266 $ nimat = 1
267
268 DO 170 imat = 1, nimat
269
270
271
272 IF( .NOT.dotype( imat ) )
273 $ GO TO 170
274
275
276
277 zerot = imat.GE.3 .AND. imat.LE.6
278 IF( zerot .AND. n.LT.imat-2 )
279 $ GO TO 170
280
281
282
283 DO 160 iuplo = 1, 2
284 uplo = uplos( iuplo )
285
286
287
288
289
290
291 CALL clatb4( matpath, imat, n, n,
TYPE, KL, KU, ANORM,
292 $ MODE, CNDNUM, DIST )
293
294
295
296 srnamt = 'CLATMS'
297 CALL clatms( n, n, dist, iseed,
TYPE, RWORK, MODE,
298 $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA,
299 $ WORK, INFO )
300
301
302
303 IF( info.NE.0 ) THEN
304 CALL alaerh( path,
'CLATMS', info, 0, uplo, n, n,
305 $ -1, -1, -1, imat, nfail, nerrs, nout )
306 GO TO 160
307 END IF
308
309
310
311
312 IF( zerot ) THEN
313 IF( imat.EQ.3 ) THEN
314 izero = 1
315 ELSE IF( imat.EQ.4 ) THEN
316 izero = n
317 ELSE
318 izero = n / 2 + 1
319 END IF
320
321 IF( imat.LT.6 ) THEN
322
323
324
325 IF( iuplo.EQ.1 ) THEN
326 ioff = ( izero-1 )*lda
327 DO 20 i = 1, izero - 1
328 a( ioff+i ) = zero
329 20 CONTINUE
330 ioff = ioff + izero
331 DO 30 i = izero, n
332 a( ioff ) = zero
333 ioff = ioff + lda
334 30 CONTINUE
335 ELSE
336 ioff = izero
337 DO 40 i = 1, izero - 1
338 a( ioff ) = zero
339 ioff = ioff + lda
340 40 CONTINUE
341 ioff = ioff - izero
342 DO 50 i = izero, n
343 a( ioff+i ) = zero
344 50 CONTINUE
345 END IF
346 ELSE
347 IF( iuplo.EQ.1 ) THEN
348
349
350
351 ioff = 0
352 DO 70 j = 1, n
353 i2 = min( j, izero )
354 DO 60 i = 1, i2
355 a( ioff+i ) = zero
356 60 CONTINUE
357 ioff = ioff + lda
358 70 CONTINUE
359 ELSE
360
361
362
363 ioff = 0
364 DO 90 j = 1, n
365 i1 = max( j, izero )
366 DO 80 i = i1, n
367 a( ioff+i ) = zero
368 80 CONTINUE
369 ioff = ioff + lda
370 90 CONTINUE
371 END IF
372 END IF
373 ELSE
374 izero = 0
375 END IF
376
377
378
379
380 DO 150 ifact = 1, nfact
381
382
383
384 fact = facts( ifact )
385
386
387
388
389 IF( zerot ) THEN
390 IF( ifact.EQ.1 )
391 $ GO TO 150
392 rcondc = zero
393
394 ELSE IF( ifact.EQ.1 ) THEN
395
396
397
398 anorm =
clanhe(
'1', uplo, n, a, lda, rwork )
399
400
401
402 CALL clacpy( uplo, n, n, a, lda, afac, lda )
404 $ lwork, info )
405
406
407
408 CALL clacpy( uplo, n, n, afac, lda, ainv, lda )
409 lwork = (n+nb+1)*(nb+3)
411 $ work, info )
412 ainvnm =
clanhe(
'1', uplo, n, ainv, lda, rwork )
413
414
415
416 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
417 rcondc = one
418 ELSE
419 rcondc = ( one / anorm ) / ainvnm
420 END IF
421 END IF
422
423
424
425 srnamt = 'CLARHS'
426 CALL clarhs( matpath, xtype, uplo,
' ', n, n, kl, ku,
427 $ nrhs, a, lda, xact, lda, b, lda, iseed,
428 $ info )
429 xtype = 'C'
430
431
432
433 IF( ifact.EQ.2 ) THEN
434 CALL clacpy( uplo, n, n, a, lda, afac, lda )
435 CALL clacpy(
'Full', n, nrhs, b, lda, x, lda )
436
437
438
439
440 srnamt = 'CHESV_ROOK'
441 CALL chesv_rook( uplo, n, nrhs, afac, lda, iwork,
442 $ x, lda, work, lwork, info )
443
444
445
446
447 k = izero
448 IF( k.GT.0 ) THEN
449 100 CONTINUE
450 IF( iwork( k ).LT.0 ) THEN
451 IF( iwork( k ).NE.-k ) THEN
452 k = -iwork( k )
453 GO TO 100
454 END IF
455 ELSE IF( iwork( k ).NE.k ) THEN
456 k = iwork( k )
457 GO TO 100
458 END IF
459 END IF
460
461
462
463 IF( info.NE.k ) THEN
464 CALL alaerh( path,
'CHESV_ROOK', info, k, uplo,
465 $ n, n, -1, -1, nrhs, imat, nfail,
466 $ nerrs, nout )
467 GO TO 120
468 ELSE IF( info.NE.0 ) THEN
469 GO TO 120
470 END IF
471
472
473
474
476 $ iwork, ainv, lda, rwork,
477 $ result( 1 ) )
478
479
480
481 CALL clacpy(
'Full', n, nrhs, b, lda, work, lda )
482 CALL cpot02( uplo, n, nrhs, a, lda, x, lda, work,
483 $ lda, rwork, result( 2 ) )
484
485
486
487
488 CALL cget04( n, nrhs, x, lda, xact, lda, rcondc,
489 $ result( 3 ) )
490 nt = 3
491
492
493
494
495 DO 110 k = 1, nt
496 IF( result( k ).GE.thresh ) THEN
497 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
498 $
CALL aladhd( nout, path )
499 WRITE( nout, fmt = 9999 )'CHESV_ROOK', uplo,
500 $ n, imat, k, result( k )
501 nfail = nfail + 1
502 END IF
503 110 CONTINUE
504 nrun = nrun + nt
505 120 CONTINUE
506 END IF
507
508 150 CONTINUE
509
510 160 CONTINUE
511 170 CONTINUE
512 180 CONTINUE
513
514
515
516 CALL alasvm( path, nout, nfail, nrun, nerrs )
517
518 9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
519 $ ', test ', i2, ', ratio =', g12.5 )
520 RETURN
521
522
523
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine clarhs(path, xtype, uplo, trans, m, n, kl, ku, nrhs, a, lda, x, ldx, b, ldb, iseed, info)
CLARHS
subroutine xlaenv(ispec, nvalue)
XLAENV
subroutine aladhd(iounit, path)
ALADHD
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
subroutine cerrvx(path, nunit)
CERRVX
subroutine cget04(n, nrhs, x, ldx, xact, ldxact, rcond, resid)
CGET04
subroutine chet01_rook(uplo, n, a, lda, afac, ldafac, ipiv, c, ldc, rwork, resid)
CHET01_ROOK
subroutine clatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
CLATB4
subroutine clatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
CLATMS
subroutine cpot02(uplo, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
CPOT02
subroutine chesv_rook(uplo, n, nrhs, a, lda, ipiv, b, ldb, work, lwork, info)
CHESV_ROOK computes the solution to a system of linear equations A * X = B for HE matrices using the ...
subroutine chetrf_rook(uplo, n, a, lda, ipiv, work, lwork, info)
CHETRF_ROOK computes the factorization of a complex Hermitian indefinite matrix using the bounded Bun...
subroutine chetri_rook(uplo, n, a, lda, ipiv, work, info)
CHETRI_ROOK computes the inverse of HE matrix using the factorization obtained with the bounded Bunch...
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
real function clanhe(norm, uplo, n, a, lda, work)
CLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...