334 SUBROUTINE zchkhb2stg( NSIZES, NN, NWDTHS, KK, NTYPES, DOTYPE,
335 $ ISEED, THRESH, NOUNIT, A, LDA, SD, SE, D1,
336 $ D2, D3, U, LDU, WORK, LWORK, RWORK, RESULT,
344 INTEGER INFO, LDA, LDU, LWORK, NOUNIT, NSIZES, NTYPES,
346 DOUBLE PRECISION THRESH
350 INTEGER ISEED( 4 ), KK( * ), NN( * )
351 DOUBLE PRECISION RESULT( * ), RWORK( * ), SD( * ), SE( * ),
352 $ d1( * ), d2( * ), d3( * )
353 COMPLEX*16 A( LDA, * ), U( LDU, * ), WORK( * )
359 COMPLEX*16 CZERO, CONE
360 PARAMETER ( CZERO = ( 0.0d+0, 0.0d+0 ),
361 $ cone = ( 1.0d+0, 0.0d+0 ) )
362 DOUBLE PRECISION ZERO, ONE, TWO, TEN
363 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0,
365 DOUBLE PRECISION HALF
366 parameter( half = one / two )
368 parameter( maxtyp = 15 )
371 LOGICAL BADNN, BADNNB
372 INTEGER I, IINFO, IMODE, ITYPE, J, JC, JCOL, JR, JSIZE,
373 $ JTYPE, JWIDTH, K, KMAX, LH, LW, MTYPES, N,
374 $ nerrs, nmats, nmax, ntest, ntestt
375 DOUBLE PRECISION ANINV, ANORM, COND, OVFL, RTOVFL, RTUNFL,
376 $ TEMP1, TEMP2, TEMP3, TEMP4, ULP, ULPINV, UNFL
379 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KMAGN( MAXTYP ),
380 $ KMODE( MAXTYP ), KTYPE( MAXTYP )
383 DOUBLE PRECISION DLAMCH
391 INTRINSIC abs, dble, dconjg, max, min, sqrt
394 DATA ktype / 1, 2, 5*4, 5*5, 3*8 /
395 DATA kmagn / 2*1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
397 DATA kmode / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
412 nmax = max( nmax, nn( j ) )
420 kmax = max( kmax, kk( j ) )
424 kmax = min( nmax-1, kmax )
428 IF( nsizes.LT.0 )
THEN
430 ELSE IF( badnn )
THEN
432 ELSE IF( nwdths.LT.0 )
THEN
434 ELSE IF( badnnb )
THEN
436 ELSE IF( ntypes.LT.0 )
THEN
438 ELSE IF( lda.LT.kmax+1 )
THEN
440 ELSE IF( ldu.LT.nmax )
THEN
442 ELSE IF( ( max( lda, nmax )+1 )*nmax.GT.lwork )
THEN
447 CALL xerbla(
'ZCHKHB2STG', -info )
453 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 .OR. nwdths.EQ.0 )
458 unfl = dlamch(
'Safe minimum' )
460 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
462 rtunfl = sqrt( unfl )
463 rtovfl = sqrt( ovfl )
470 DO 190 jsize = 1, nsizes
472 aninv = one / dble( max( 1, n ) )
474 DO 180 jwidth = 1, nwdths
478 k = max( 0, min( n-1, k ) )
480 IF( nsizes.NE.1 )
THEN
481 mtypes = min( maxtyp, ntypes )
483 mtypes = min( maxtyp+1, ntypes )
486 DO 170 jtype = 1, mtypes
487 IF( .NOT.dotype( jtype ) )
493 ioldsd( j ) = iseed( j )
513 IF( mtypes.GT.maxtyp )
516 itype = ktype( jtype )
517 imode = kmode( jtype )
521 GO TO ( 40, 50, 60 )kmagn( jtype )
528 anorm = ( rtovfl*ulp )*aninv
532 anorm = rtunfl*n*ulpinv
537 CALL zlaset(
'Full', lda, n, czero, czero, a, lda )
539 IF( jtype.LE.15 )
THEN
542 cond = ulpinv*aninv / ten
549 IF( itype.EQ.1 )
THEN
552 ELSE IF( itype.EQ.2 )
THEN
557 a( k+1, jcol ) = anorm
560 ELSE IF( itype.EQ.4 )
THEN
564 CALL zlatms( n, n,
'S', iseed,
'H', rwork, imode,
565 $ cond, anorm, 0, 0,
'Q', a( k+1, 1 ), lda,
568 ELSE IF( itype.EQ.5 )
THEN
572 CALL zlatms( n, n,
'S', iseed,
'H', rwork, imode,
573 $ cond, anorm, k, k,
'Q', a, lda, work,
576 ELSE IF( itype.EQ.7 )
THEN
580 CALL zlatmr( n, n,
'S', iseed,
'H', work, 6, one,
581 $ cone,
'T',
'N', work( n+1 ), 1, one,
582 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
583 $ zero, anorm,
'Q', a( k+1, 1 ), lda,
586 ELSE IF( itype.EQ.8 )
THEN
590 CALL zlatmr( n, n,
'S', iseed,
'H', work, 6, one,
591 $ cone,
'T',
'N', work( n+1 ), 1, one,
592 $ work( 2*n+1 ), 1, one,
'N', idumma, k, k,
593 $ zero, anorm,
'Q', a, lda, idumma, iinfo )
595 ELSE IF( itype.EQ.9 )
THEN
599 CALL zlatms( n, n,
'S', iseed,
'P', rwork, imode,
600 $ cond, anorm, k, k,
'Q', a, lda,
601 $ work( n+1 ), iinfo )
603 ELSE IF( itype.EQ.10 )
THEN
609 CALL zlatms( n, n,
'S', iseed,
'P', rwork, imode,
610 $ cond, anorm, 1, 1,
'Q', a( k, 1 ), lda,
613 temp1 = abs( a( k, i ) ) /
614 $ sqrt( abs( a( k+1, i-1 )*a( k+1, i ) ) )
615 IF( temp1.GT.half )
THEN
616 a( k, i ) = half*sqrt( abs( a( k+1,
617 $ i-1 )*a( k+1, i ) ) )
626 IF( iinfo.NE.0 )
THEN
627 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n,
637 CALL zlacpy(
' ', k+1, n, a, lda, work, lda )
640 CALL zhbtrd(
'V',
'U', n, k, work, lda, sd, se, u, ldu,
641 $ work( lda*n+1 ), iinfo )
643 IF( iinfo.NE.0 )
THEN
644 WRITE( nounit, fmt = 9999 )
'ZHBTRD(U)', iinfo, n,
647 IF( iinfo.LT.0 )
THEN
657 CALL zhbt21(
'Upper', n, k, 1, a, lda, sd, se, u, ldu,
658 $ work, rwork, result( 1 ) )
672 CALL dcopy( n, sd, 1, d1, 1 )
674 $
CALL dcopy( n-1, se, 1, rwork, 1 )
676 CALL zsteqr(
'N', n, d1, rwork, work, ldu,
677 $ rwork( n+1 ), iinfo )
678 IF( iinfo.NE.0 )
THEN
679 WRITE( nounit, fmt = 9999 )
'ZSTEQR(N)', iinfo, n,
682 IF( iinfo.LT.0 )
THEN
695 CALL dlaset(
'Full', n, 1, zero, zero, sd, n )
696 CALL dlaset(
'Full', n, 1, zero, zero, se, n )
697 CALL zlacpy(
' ', k+1, n, a, lda, u, ldu )
701 $ work, lh, work( lh+1 ), lw, iinfo )
705 CALL dcopy( n, sd, 1, d2, 1 )
707 $
CALL dcopy( n-1, se, 1, rwork, 1 )
709 CALL zsteqr(
'N', n, d2, rwork, work, ldu,
710 $ rwork( n+1 ), iinfo )
711 IF( iinfo.NE.0 )
THEN
712 WRITE( nounit, fmt = 9999 )
'ZSTEQR(N)', iinfo, n,
715 IF( iinfo.LT.0 )
THEN
727 DO 110 jr = 0, min( k, n-jc )
728 a( jr+1, jc ) = dconjg( a( k+1-jr, jc+jr ) )
731 DO 140 jc = n + 1 - k, n
732 DO 130 jr = min( k, n-jc ) + 1, k
739 CALL zlacpy(
' ', k+1, n, a, lda, work, lda )
742 CALL zhbtrd(
'V',
'L', n, k, work, lda, sd, se, u, ldu,
743 $ work( lda*n+1 ), iinfo )
745 IF( iinfo.NE.0 )
THEN
746 WRITE( nounit, fmt = 9999 )
'ZHBTRD(L)', iinfo, n,
749 IF( iinfo.LT.0 )
THEN
760 CALL zhbt21(
'Lower', n, k, 1, a, lda, sd, se, u, ldu,
761 $ work, rwork, result( 3 ) )
768 CALL dlaset(
'Full', n, 1, zero, zero, sd, n )
769 CALL dlaset(
'Full', n, 1, zero, zero, se, n )
770 CALL zlacpy(
' ', k+1, n, a, lda, u, ldu )
774 $ work, lh, work( lh+1 ), lw, iinfo )
778 CALL dcopy( n, sd, 1, d3, 1 )
780 $
CALL dcopy( n-1, se, 1, rwork, 1 )
782 CALL zsteqr(
'N', n, d3, rwork, work, ldu,
783 $ rwork( n+1 ), iinfo )
784 IF( iinfo.NE.0 )
THEN
785 WRITE( nounit, fmt = 9999 )
'ZSTEQR(N)', iinfo, n,
788 IF( iinfo.LT.0 )
THEN
807 temp1 = max( temp1, abs( d1( j ) ), abs( d2( j ) ) )
808 temp2 = max( temp2, abs( d1( j )-d2( j ) ) )
809 temp3 = max( temp3, abs( d1( j ) ), abs( d3( j ) ) )
810 temp4 = max( temp4, abs( d1( j )-d3( j ) ) )
813 result(5) = temp2 / max( unfl, ulp*max( temp1, temp2 ) )
814 result(6) = temp4 / max( unfl, ulp*max( temp3, temp4 ) )
819 ntestt = ntestt + ntest
824 IF( result( jr ).GE.thresh )
THEN
829 IF( nerrs.EQ.0 )
THEN
830 WRITE( nounit, fmt = 9998 )
'ZHB'
831 WRITE( nounit, fmt = 9997 )
832 WRITE( nounit, fmt = 9996 )
833 WRITE( nounit, fmt = 9995 )
'Hermitian'
834 WRITE( nounit, fmt = 9994 )
'unitary',
'*',
835 $
'conjugate transpose', (
'*', j = 1, 6 )
838 WRITE( nounit, fmt = 9993 )n, k, ioldsd, jtype,
849 CALL dlasum(
'ZHB', nounit, nerrs, ntestt )
852 9999
FORMAT(
' ZCHKHB2STG: ', a,
' returned INFO=', i6,
'.', / 9x,
853 $
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
855 9998
FORMAT( / 1x, a3,
856 $
' -- Complex Hermitian Banded Tridiagonal Reduction Routines'
858 9997
FORMAT(
' Matrix types (see DCHK23 for details): ' )
860 9996
FORMAT( /
' Special Matrices:',
861 $ /
' 1=Zero matrix. ',
862 $
' 5=Diagonal: clustered entries.',
863 $ /
' 2=Identity matrix. ',
864 $
' 6=Diagonal: large, evenly spaced.',
865 $ /
' 3=Diagonal: evenly spaced entries. ',
866 $
' 7=Diagonal: small, evenly spaced.',
867 $ /
' 4=Diagonal: geometr. spaced entries.' )
868 9995
FORMAT(
' Dense ', a,
' Banded Matrices:',
869 $ /
' 8=Evenly spaced eigenvals. ',
870 $
' 12=Small, evenly spaced eigenvals.',
871 $ /
' 9=Geometrically spaced eigenvals. ',
872 $
' 13=Matrix with random O(1) entries.',
873 $ /
' 10=Clustered eigenvalues. ',
874 $
' 14=Matrix with large random entries.',
875 $ /
' 11=Large, evenly spaced eigenvals. ',
876 $
' 15=Matrix with small random entries.' )
878 9994
FORMAT( /
' Tests performed: (S is Tridiag, U is ', a,
',',
879 $ / 20x, a,
' means ', a,
'.', /
' UPLO=''U'':',
880 $ /
' 1= | A - U S U', a1,
' | / ( |A| n ulp ) ',
881 $
' 2= | I - U U', a1,
' | / ( n ulp )', /
' UPLO=''L'':',
882 $ /
' 3= | A - U S U', a1,
' | / ( |A| n ulp ) ',
883 $
' 4= | I - U U', a1,
' | / ( n ulp )' /
' Eig check:',
884 $ /
' 5= | D1 - D2',
'',
' | / ( |D1| ulp ) ',
885 $
' 6= | D1 - D3',
'',
' | / ( |D1| ulp ) ' )
886 9993
FORMAT(
' N=', i5,
', K=', i4,
', seed=', 4( i4,
',' ),
' type ',
887 $ i2,
', test(', i2,
')=', g10.3 )
subroutine xerbla(srname, info)
subroutine dlasum(type, iounit, ie, nrun)
DLASUM
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine zhbtrd(vect, uplo, n, kd, ab, ldab, d, e, q, ldq, work, info)
ZHBTRD
subroutine zhetrd_hb2st(stage1, vect, uplo, n, kd, ab, ldab, d, e, hous, lhous, work, lwork, info)
ZHETRD_HB2ST reduces a complex Hermitian band matrix A to real symmetric tridiagonal form T
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine zsteqr(compz, n, d, e, z, ldz, work, info)
ZSTEQR
subroutine zchkhb2stg(nsizes, nn, nwdths, kk, ntypes, dotype, iseed, thresh, nounit, a, lda, sd, se, d1, d2, d3, u, ldu, work, lwork, rwork, result, info)
ZCHKHB2STG
subroutine zhbt21(uplo, n, ka, ks, a, lda, d, e, u, ldu, work, rwork, result)
ZHBT21
subroutine zlatmr(m, n, dist, iseed, sym, d, mode, cond, dmax, rsign, grade, dl, model, condl, dr, moder, condr, pivtng, ipivot, kl, ku, sparse, anorm, pack, a, lda, iwork, info)
ZLATMR
subroutine zlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
ZLATMS