170
171
172
173
174
175
176 LOGICAL TSTERR
177 INTEGER NMAX, NN, NNB, NNS, NOUT
178 DOUBLE PRECISION THRESH
179
180
181 LOGICAL DOTYPE( * )
182 INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
183 DOUBLE PRECISION A( * ), AFAC( * ), AINV( * ), B( * ),
184 $ RWORK( * ), WORK( * ), X( * ), XACT( * )
185
186
187
188
189
190 DOUBLE PRECISION ZERO
191 parameter( zero = 0.0d+0 )
192 INTEGER NTYPES
193 parameter( ntypes = 10 )
194 INTEGER NTESTS
195 parameter( ntests = 9 )
196
197
198 LOGICAL TRFCON, ZEROT
199 CHARACTER DIST, TYPE, UPLO, XTYPE
200 CHARACTER*3 PATH
201 INTEGER I, I1, I2, IMAT, IN, INB, INFO, IOFF, IRHS,
202 $ IUPLO, IZERO, J, K, KL, KU, LDA, LWORK, MODE,
203 $ N, NB, NERRS, NFAIL, NIMAT, NRHS, NRUN, NT
204 DOUBLE PRECISION ANORM, CNDNUM, RCOND, RCONDC
205
206
207 CHARACTER UPLOS( 2 )
208 INTEGER ISEED( 4 ), ISEEDY( 4 )
209 DOUBLE PRECISION RESULT( NTESTS )
210
211
212 DOUBLE PRECISION DGET06, DLANSY
214
215
220
221
222 INTRINSIC max, min
223
224
225 LOGICAL LERR, OK
226 CHARACTER*32 SRNAMT
227 INTEGER INFOT, NUNIT
228
229
230 COMMON / infoc / infot, nunit, ok, lerr
231 COMMON / srnamc / srnamt
232
233
234 DATA iseedy / 1988, 1989, 1990, 1991 /
235 DATA uplos / 'U', 'L' /
236
237
238
239
240
241 path( 1: 1 ) = 'Double precision'
242 path( 2: 3 ) = 'SY'
243 nrun = 0
244 nfail = 0
245 nerrs = 0
246 DO 10 i = 1, 4
247 iseed( i ) = iseedy( i )
248 10 CONTINUE
249
250
251
252 IF( tsterr )
253 $
CALL derrsy( path, nout )
254 infot = 0
255
256
257
258
260
261
262
263 DO 180 in = 1, nn
264 n = nval( in )
265 lda = max( n, 1 )
266 xtype = 'N'
267 nimat = ntypes
268 IF( n.LE.0 )
269 $ nimat = 1
270
271 izero = 0
272
273
274
275 DO 170 imat = 1, nimat
276
277
278
279 IF( .NOT.dotype( imat ) )
280 $ GO TO 170
281
282
283
284 zerot = imat.GE.3 .AND. imat.LE.6
285 IF( zerot .AND. n.LT.imat-2 )
286 $ GO TO 170
287
288
289
290 DO 160 iuplo = 1, 2
291 uplo = uplos( iuplo )
292
293
294
295
296
297
298
299 CALL dlatb4( path, imat, n, n,
TYPE, KL, KU, ANORM, MODE,
300 $ CNDNUM, DIST )
301
302
303
304 srnamt = 'DLATMS'
305 CALL dlatms( n, n, dist, iseed,
TYPE, RWORK, MODE,
306 $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
307 $ INFO )
308
309
310
311 IF( info.NE.0 ) THEN
312 CALL alaerh( path,
'DLATMS', info, 0, uplo, n, n, -1,
313 $ -1, -1, imat, nfail, nerrs, nout )
314
315
316
317 GO TO 160
318 END IF
319
320
321
322
323
324 IF( zerot ) THEN
325 IF( imat.EQ.3 ) THEN
326 izero = 1
327 ELSE IF( imat.EQ.4 ) THEN
328 izero = n
329 ELSE
330 izero = n / 2 + 1
331 END IF
332
333 IF( imat.LT.6 ) THEN
334
335
336
337 IF( iuplo.EQ.1 ) THEN
338 ioff = ( izero-1 )*lda
339 DO 20 i = 1, izero - 1
340 a( ioff+i ) = zero
341 20 CONTINUE
342 ioff = ioff + izero
343 DO 30 i = izero, n
344 a( ioff ) = zero
345 ioff = ioff + lda
346 30 CONTINUE
347 ELSE
348 ioff = izero
349 DO 40 i = 1, izero - 1
350 a( ioff ) = zero
351 ioff = ioff + lda
352 40 CONTINUE
353 ioff = ioff - izero
354 DO 50 i = izero, n
355 a( ioff+i ) = zero
356 50 CONTINUE
357 END IF
358 ELSE
359 IF( iuplo.EQ.1 ) THEN
360
361
362
363 ioff = 0
364 DO 70 j = 1, n
365 i2 = min( j, izero )
366 DO 60 i = 1, i2
367 a( ioff+i ) = zero
368 60 CONTINUE
369 ioff = ioff + lda
370 70 CONTINUE
371 ELSE
372
373
374
375 ioff = 0
376 DO 90 j = 1, n
377 i1 = max( j, izero )
378 DO 80 i = i1, n
379 a( ioff+i ) = zero
380 80 CONTINUE
381 ioff = ioff + lda
382 90 CONTINUE
383 END IF
384 END IF
385 ELSE
386 izero = 0
387 END IF
388
389
390
391
392
393 DO 150 inb = 1, nnb
394
395
396
397
398 nb = nbval( inb )
400
401
402
403
404
405 CALL dlacpy( uplo, n, n, a, lda, afac, lda )
406
407
408
409
410
411
412 lwork = max( 2, nb )*lda
413 srnamt = 'DSYTRF'
414 CALL dsytrf( uplo, n, afac, lda, iwork, ainv, lwork,
415 $ info )
416
417
418
419
420 k = izero
421 IF( k.GT.0 ) THEN
422 100 CONTINUE
423 IF( iwork( k ).LT.0 ) THEN
424 IF( iwork( k ).NE.-k ) THEN
425 k = -iwork( k )
426 GO TO 100
427 END IF
428 ELSE IF( iwork( k ).NE.k ) THEN
429 k = iwork( k )
430 GO TO 100
431 END IF
432 END IF
433
434
435
436 IF( info.NE.k )
437 $
CALL alaerh( path,
'DSYTRF', info, k, uplo, n, n,
438 $ -1, -1, nb, imat, nfail, nerrs, nout )
439
440
441
442 IF( info.NE.0 ) THEN
443 trfcon = .true.
444 ELSE
445 trfcon = .false.
446 END IF
447
448
449
450
451 CALL dsyt01( uplo, n, a, lda, afac, lda, iwork, ainv,
452 $ lda, rwork, result( 1 ) )
453 nt = 1
454
455
456
457
458
459
460
461 IF( inb.EQ.1 .AND. .NOT.trfcon ) THEN
462 CALL dlacpy( uplo, n, n, afac, lda, ainv, lda )
463 srnamt = 'DSYTRI2'
464 lwork = (n+nb+1)*(nb+3)
465 CALL dsytri2( uplo, n, ainv, lda, iwork, work,
466 $ lwork, info )
467
468
469
470 IF( info.NE.0 )
471 $
CALL alaerh( path,
'DSYTRI2', info, -1, uplo, n,
472 $ n, -1, -1, -1, imat, nfail, nerrs,
473 $ nout )
474
475
476
477
478 CALL dpot03( uplo, n, a, lda, ainv, lda, work, lda,
479 $ rwork, rcondc, result( 2 ) )
480 nt = 2
481 END IF
482
483
484
485
486 DO 110 k = 1, nt
487 IF( result( k ).GE.thresh ) THEN
488 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
489 $
CALL alahd( nout, path )
490 WRITE( nout, fmt = 9999 )uplo, n, nb, imat, k,
491 $ result( k )
492 nfail = nfail + 1
493 END IF
494 110 CONTINUE
495 nrun = nrun + nt
496
497
498
499
500 IF( inb.GT.1 )
501 $ GO TO 150
502
503
504
505 IF( trfcon ) THEN
506 rcondc = zero
507 GO TO 140
508 END IF
509
510
511
512 DO 130 irhs = 1, nns
513 nrhs = nsval( irhs )
514
515
516
517
518
519
520
521 srnamt = 'DLARHS'
522 CALL dlarhs( path, xtype, uplo,
' ', n, n, kl, ku,
523 $ nrhs, a, lda, xact, lda, b, lda,
524 $ iseed, info )
525 CALL dlacpy(
'Full', n, nrhs, b, lda, x, lda )
526
527 srnamt = 'DSYTRS'
528 CALL dsytrs( uplo, n, nrhs, afac, lda, iwork, x,
529 $ lda, info )
530
531
532
533 IF( info.NE.0 )
534 $
CALL alaerh( path,
'DSYTRS', info, 0, uplo, n,
535 $ n, -1, -1, nrhs, imat, nfail,
536 $ nerrs, nout )
537
538 CALL dlacpy(
'Full', n, nrhs, b, lda, work, lda )
539
540
541
542 CALL dpot02( uplo, n, nrhs, a, lda, x, lda, work,
543 $ lda, rwork, result( 3 ) )
544
545
546
547
548
549
550
551
552 srnamt = 'DLARHS'
553 CALL dlarhs( path, xtype, uplo,
' ', n, n, kl, ku,
554 $ nrhs, a, lda, xact, lda, b, lda,
555 $ iseed, info )
556 CALL dlacpy(
'Full', n, nrhs, b, lda, x, lda )
557
558 srnamt = 'DSYTRS2'
559 CALL dsytrs2( uplo, n, nrhs, afac, lda, iwork, x,
560 $ lda, work, info )
561
562
563
564 IF( info.NE.0 )
565 $
CALL alaerh( path,
'DSYTRS2', info, 0, uplo, n,
566 $ n, -1, -1, nrhs, imat, nfail,
567 $ nerrs, nout )
568
569 CALL dlacpy(
'Full', n, nrhs, b, lda, work, lda )
570
571
572
573 CALL dpot02( uplo, n, nrhs, a, lda, x, lda, work,
574 $ lda, rwork, result( 4 ) )
575
576
577
578
579 CALL dget04( n, nrhs, x, lda, xact, lda, rcondc,
580 $ result( 5 ) )
581
582
583
584
585 srnamt = 'DSYRFS'
586 CALL dsyrfs( uplo, n, nrhs, a, lda, afac, lda,
587 $ iwork, b, lda, x, lda, rwork,
588 $ rwork( nrhs+1 ), work, iwork( n+1 ),
589 $ info )
590
591
592
593 IF( info.NE.0 )
594 $
CALL alaerh( path,
'DSYRFS', info, 0, uplo, n,
595 $ n, -1, -1, nrhs, imat, nfail,
596 $ nerrs, nout )
597
598 CALL dget04( n, nrhs, x, lda, xact, lda, rcondc,
599 $ result( 6 ) )
600 CALL dpot05( uplo, n, nrhs, a, lda, b, lda, x, lda,
601 $ xact, lda, rwork, rwork( nrhs+1 ),
602 $ result( 7 ) )
603
604
605
606
607 DO 120 k = 3, 8
608 IF( result( k ).GE.thresh ) THEN
609 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
610 $
CALL alahd( nout, path )
611 WRITE( nout, fmt = 9998 )uplo, n, nrhs,
612 $ imat, k, result( k )
613 nfail = nfail + 1
614 END IF
615 120 CONTINUE
616 nrun = nrun + 6
617
618
619
620 130 CONTINUE
621
622
623
624
625 140 CONTINUE
626 anorm =
dlansy(
'1', uplo, n, a, lda, rwork )
627 srnamt = 'DSYCON'
628 CALL dsycon( uplo, n, afac, lda, iwork, anorm, rcond,
629 $ work, iwork( n+1 ), info )
630
631
632
633 IF( info.NE.0 )
634 $
CALL alaerh( path,
'DSYCON', info, 0, uplo, n, n,
635 $ -1, -1, -1, imat, nfail, nerrs, nout )
636
637
638
639 result( 9 ) =
dget06( rcond, rcondc )
640
641
642
643
644 IF( result( 9 ).GE.thresh ) THEN
645 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
646 $
CALL alahd( nout, path )
647 WRITE( nout, fmt = 9997 )uplo, n, imat, 9,
648 $ result( 9 )
649 nfail = nfail + 1
650 END IF
651 nrun = nrun + 1
652 150 CONTINUE
653
654 160 CONTINUE
655 170 CONTINUE
656 180 CONTINUE
657
658
659
660 CALL alasum( path, nout, nfail, nrun, nerrs )
661
662 9999 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NB =', i4, ', type ',
663 $ i2, ', test ', i2, ', ratio =', g12.5 )
664 9998 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NRHS=', i3, ', type ',
665 $ i2, ', test(', i2, ') =', g12.5 )
666 9997 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ',', 10x, ' type ', i2,
667 $ ', test(', i2, ') =', g12.5 )
668 RETURN
669
670
671
subroutine alasum(type, nout, nfail, nrun, nerrs)
ALASUM
subroutine dlarhs(path, xtype, uplo, trans, m, n, kl, ku, nrhs, a, lda, x, ldx, b, ldb, iseed, info)
DLARHS
subroutine xlaenv(ispec, nvalue)
XLAENV
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
subroutine alahd(iounit, path)
ALAHD
subroutine derrsy(path, nunit)
DERRSY
subroutine dget04(n, nrhs, x, ldx, xact, ldxact, rcond, resid)
DGET04
double precision function dget06(rcond, rcondc)
DGET06
subroutine dlatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
DLATB4
subroutine dlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
DLATMS
subroutine dpot02(uplo, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
DPOT02
subroutine dpot03(uplo, n, a, lda, ainv, ldainv, work, ldwork, rwork, rcond, resid)
DPOT03
subroutine dpot05(uplo, n, nrhs, a, lda, b, ldb, x, ldx, xact, ldxact, ferr, berr, reslts)
DPOT05
subroutine dsyt01(uplo, n, a, lda, afac, ldafac, ipiv, c, ldc, rwork, resid)
DSYT01
subroutine dsycon(uplo, n, a, lda, ipiv, anorm, rcond, work, iwork, info)
DSYCON
subroutine dsyrfs(uplo, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x, ldx, ferr, berr, work, iwork, info)
DSYRFS
subroutine dsytrf(uplo, n, a, lda, ipiv, work, lwork, info)
DSYTRF
subroutine dsytri2(uplo, n, a, lda, ipiv, work, lwork, info)
DSYTRI2
subroutine dsytrs2(uplo, n, nrhs, a, lda, ipiv, b, ldb, work, info)
DSYTRS2
subroutine dsytrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
DSYTRS
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
double precision function dlansy(norm, uplo, n, a, lda, work)
DLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...