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