329 SUBROUTINE dchksb2stg( NSIZES, NN, NWDTHS, KK, NTYPES, DOTYPE,
330 $ ISEED, THRESH, NOUNIT, A, LDA, SD, SE, D1,
331 $ D2, D3, U, LDU, WORK, LWORK, RESULT, INFO )
338 INTEGER INFO, LDA, LDU, LWORK, NOUNIT, NSIZES, NTYPES,
340 DOUBLE PRECISION THRESH
344 INTEGER ISEED( 4 ), KK( * ), NN( * )
345 DOUBLE PRECISION A( LDA, * ), RESULT( * ), SD( * ), SE( * ),
346 $ d1( * ), d2( * ), d3( * ),
347 $ u( ldu, * ), work( * )
353 DOUBLE PRECISION ZERO, ONE, TWO, TEN
354 PARAMETER ( ZERO = 0.0d0, one = 1.0d0, two = 2.0d0,
356 DOUBLE PRECISION HALF
357 PARAMETER ( HALF = one / two )
359 parameter( maxtyp = 15 )
362 LOGICAL BADNN, BADNNB
363 INTEGER I, IINFO, IMODE, ITYPE, J, JC, JCOL, JR, JSIZE,
364 $ jtype, jwidth, k, kmax, lh, lw, mtypes, n,
365 $ nerrs, nmats, nmax, ntest, ntestt
366 DOUBLE PRECISION ANINV, ANORM, COND, OVFL, RTOVFL, RTUNFL,
367 $ TEMP1, TEMP2, TEMP3, TEMP4, ULP, ULPINV, UNFL
370 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KMAGN( MAXTYP ),
371 $ KMODE( MAXTYP ), KTYPE( MAXTYP )
374 DOUBLE PRECISION DLAMCH
382 INTRINSIC abs, dble, max, min, sqrt
385 DATA ktype / 1, 2, 5*4, 5*5, 3*8 /
386 DATA kmagn / 2*1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
388 DATA kmode / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
403 nmax = max( nmax, nn( j ) )
411 kmax = max( kmax, kk( j ) )
415 kmax = min( nmax-1, kmax )
419 IF( nsizes.LT.0 )
THEN
421 ELSE IF( badnn )
THEN
423 ELSE IF( nwdths.LT.0 )
THEN
425 ELSE IF( badnnb )
THEN
427 ELSE IF( ntypes.LT.0 )
THEN
429 ELSE IF( lda.LT.kmax+1 )
THEN
431 ELSE IF( ldu.LT.nmax )
THEN
433 ELSE IF( ( max( lda, nmax )+1 )*nmax.GT.lwork )
THEN
438 CALL xerbla(
'DCHKSB2STG', -info )
444 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 .OR. nwdths.EQ.0 )
449 unfl = dlamch(
'Safe minimum' )
451 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
453 rtunfl = sqrt( unfl )
454 rtovfl = sqrt( ovfl )
461 DO 190 jsize = 1, nsizes
463 aninv = one / dble( max( 1, n ) )
465 DO 180 jwidth = 1, nwdths
469 k = max( 0, min( n-1, k ) )
471 IF( nsizes.NE.1 )
THEN
472 mtypes = min( maxtyp, ntypes )
474 mtypes = min( maxtyp+1, ntypes )
477 DO 170 jtype = 1, mtypes
478 IF( .NOT.dotype( jtype ) )
484 ioldsd( j ) = iseed( j )
504 IF( mtypes.GT.maxtyp )
507 itype = ktype( jtype )
508 imode = kmode( jtype )
512 GO TO ( 40, 50, 60 )kmagn( jtype )
519 anorm = ( rtovfl*ulp )*aninv
523 anorm = rtunfl*n*ulpinv
528 CALL dlaset(
'Full', lda, n, zero, zero, a, lda )
530 IF( jtype.LE.15 )
THEN
533 cond = ulpinv*aninv / ten
540 IF( itype.EQ.1 )
THEN
543 ELSE IF( itype.EQ.2 )
THEN
548 a( k+1, jcol ) = anorm
551 ELSE IF( itype.EQ.4 )
THEN
555 CALL dlatms( n, n,
'S', iseed,
'S', work, imode, cond,
556 $ anorm, 0, 0,
'Q', a( k+1, 1 ), lda,
557 $ work( n+1 ), iinfo )
559 ELSE IF( itype.EQ.5 )
THEN
563 CALL dlatms( n, n,
'S', iseed,
'S', work, imode, cond,
564 $ anorm, k, k,
'Q', a, lda, work( n+1 ),
567 ELSE IF( itype.EQ.7 )
THEN
571 CALL dlatmr( n, n,
'S', iseed,
'S', work, 6, one, one,
572 $
'T',
'N', work( n+1 ), 1, one,
573 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
574 $ zero, anorm,
'Q', a( k+1, 1 ), lda,
577 ELSE IF( itype.EQ.8 )
THEN
581 CALL dlatmr( n, n,
'S', iseed,
'S', work, 6, one, one,
582 $
'T',
'N', work( n+1 ), 1, one,
583 $ work( 2*n+1 ), 1, one,
'N', idumma, k, k,
584 $ zero, anorm,
'Q', a, lda, idumma, iinfo )
586 ELSE IF( itype.EQ.9 )
THEN
590 CALL dlatms( n, n,
'S', iseed,
'P', work, imode, cond,
591 $ anorm, k, k,
'Q', a, lda, work( n+1 ),
594 ELSE IF( itype.EQ.10 )
THEN
600 CALL dlatms( n, n,
'S', iseed,
'P', work, imode, cond,
601 $ anorm, 1, 1,
'Q', a( k, 1 ), lda,
602 $ work( n+1 ), iinfo )
604 temp1 = abs( a( k, i ) ) /
605 $ sqrt( abs( a( k+1, i-1 )*a( k+1, i ) ) )
606 IF( temp1.GT.half )
THEN
607 a( k, i ) = half*sqrt( abs( a( k+1,
608 $ i-1 )*a( k+1, i ) ) )
617 IF( iinfo.NE.0 )
THEN
618 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n,
628 CALL dlacpy(
' ', k+1, n, a, lda, work, lda )
631 CALL dsbtrd(
'V',
'U', n, k, work, lda, sd, se, u, ldu,
632 $ work( lda*n+1 ), iinfo )
634 IF( iinfo.NE.0 )
THEN
635 WRITE( nounit, fmt = 9999 )
'DSBTRD(U)', iinfo, n,
638 IF( iinfo.LT.0 )
THEN
648 CALL dsbt21(
'Upper', n, k, 1, a, lda, sd, se, u, ldu,
649 $ work, result( 1 ) )
663 CALL dcopy( n, sd, 1, d1, 1 )
665 $
CALL dcopy( n-1, se, 1, work, 1 )
667 CALL dsteqr(
'N', n, d1, work, work( n+1 ), ldu,
668 $ work( n+1 ), iinfo )
669 IF( iinfo.NE.0 )
THEN
670 WRITE( nounit, fmt = 9999 )
'DSTEQR(N)', iinfo, n,
673 IF( iinfo.LT.0 )
THEN
686 CALL dlaset(
'Full', n, 1, zero, zero, sd, n )
687 CALL dlaset(
'Full', n, 1, zero, zero, se, n )
688 CALL dlacpy(
' ', k+1, n, a, lda, u, ldu )
692 $ work, lh, work( lh+1 ), lw, iinfo )
696 CALL dcopy( n, sd, 1, d2, 1 )
698 $
CALL dcopy( n-1, se, 1, work, 1 )
700 CALL dsteqr(
'N', n, d2, work, work( n+1 ), ldu,
701 $ work( n+1 ), iinfo )
702 IF( iinfo.NE.0 )
THEN
703 WRITE( nounit, fmt = 9999 )
'DSTEQR(N)', iinfo, n,
706 IF( iinfo.LT.0 )
THEN
718 DO 110 jr = 0, min( k, n-jc )
719 a( jr+1, jc ) = a( k+1-jr, jc+jr )
722 DO 140 jc = n + 1 - k, n
723 DO 130 jr = min( k, n-jc ) + 1, k
730 CALL dlacpy(
' ', k+1, n, a, lda, work, lda )
733 CALL dsbtrd(
'V',
'L', n, k, work, lda, sd, se, u, ldu,
734 $ work( lda*n+1 ), iinfo )
736 IF( iinfo.NE.0 )
THEN
737 WRITE( nounit, fmt = 9999 )
'DSBTRD(L)', iinfo, n,
740 IF( iinfo.LT.0 )
THEN
751 CALL dsbt21(
'Lower', n, k, 1, a, lda, sd, se, u, ldu,
752 $ work, result( 3 ) )
759 CALL dlaset(
'Full', n, 1, zero, zero, sd, n )
760 CALL dlaset(
'Full', n, 1, zero, zero, se, n )
761 CALL dlacpy(
' ', k+1, n, a, lda, u, ldu )
765 $ work, lh, work( lh+1 ), lw, iinfo )
769 CALL dcopy( n, sd, 1, d3, 1 )
771 $
CALL dcopy( n-1, se, 1, work, 1 )
773 CALL dsteqr(
'N', n, d3, work, work( n+1 ), ldu,
774 $ work( n+1 ), iinfo )
775 IF( iinfo.NE.0 )
THEN
776 WRITE( nounit, fmt = 9999 )
'DSTEQR(N)', iinfo, n,
779 IF( iinfo.LT.0 )
THEN
798 temp1 = max( temp1, abs( d1( j ) ), abs( d2( j ) ) )
799 temp2 = max( temp2, abs( d1( j )-d2( j ) ) )
800 temp3 = max( temp3, abs( d1( j ) ), abs( d3( j ) ) )
801 temp4 = max( temp4, abs( d1( j )-d3( j ) ) )
804 result(5) = temp2 / max( unfl, ulp*max( temp1, temp2 ) )
805 result(6) = temp4 / max( unfl, ulp*max( temp3, temp4 ) )
810 ntestt = ntestt + ntest
815 IF( result( jr ).GE.thresh )
THEN
820 IF( nerrs.EQ.0 )
THEN
821 WRITE( nounit, fmt = 9998 )
'DSB'
822 WRITE( nounit, fmt = 9997 )
823 WRITE( nounit, fmt = 9996 )
824 WRITE( nounit, fmt = 9995 )
'Symmetric'
825 WRITE( nounit, fmt = 9994 )
'orthogonal',
'''',
826 $
'transpose', (
'''', j = 1, 6 )
829 WRITE( nounit, fmt = 9993 )n, k, ioldsd, jtype,
840 CALL dlasum(
'DSB', nounit, nerrs, ntestt )
843 9999
FORMAT(
' DCHKSB2STG: ', a,
' returned INFO=', i6,
'.', / 9x,
844 $
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
847 9998
FORMAT( / 1x, a3,
848 $
' -- Real Symmetric Banded Tridiagonal Reduction Routines' )
849 9997
FORMAT(
' Matrix types (see DCHKSB2STG for details): ' )
851 9996
FORMAT( /
' Special Matrices:',
852 $ /
' 1=Zero matrix. ',
853 $
' 5=Diagonal: clustered entries.',
854 $ /
' 2=Identity matrix. ',
855 $
' 6=Diagonal: large, evenly spaced.',
856 $ /
' 3=Diagonal: evenly spaced entries. ',
857 $
' 7=Diagonal: small, evenly spaced.',
858 $ /
' 4=Diagonal: geometr. spaced entries.' )
859 9995
FORMAT(
' Dense ', a,
' Banded Matrices:',
860 $ /
' 8=Evenly spaced eigenvals. ',
861 $
' 12=Small, evenly spaced eigenvals.',
862 $ /
' 9=Geometrically spaced eigenvals. ',
863 $
' 13=Matrix with random O(1) entries.',
864 $ /
' 10=Clustered eigenvalues. ',
865 $
' 14=Matrix with large random entries.',
866 $ /
' 11=Large, evenly spaced eigenvals. ',
867 $
' 15=Matrix with small random entries.' )
869 9994
FORMAT( /
' Tests performed: (S is Tridiag, U is ', a,
',',
870 $ / 20x, a,
' means ', a,
'.', /
' UPLO=''U'':',
871 $ /
' 1= | A - U S U', a1,
' | / ( |A| n ulp ) ',
872 $
' 2= | I - U U', a1,
' | / ( n ulp )', /
' UPLO=''L'':',
873 $ /
' 3= | A - U S U', a1,
' | / ( |A| n ulp ) ',
874 $
' 4= | I - U U', a1,
' | / ( n ulp )' /
' Eig check:',
875 $ /
' 5= | D1 - D2',
'',
' | / ( |D1| ulp ) ',
876 $
' 6= | D1 - D3',
'',
' | / ( |D1| ulp ) ' )
877 9993
FORMAT(
' N=', i5,
', K=', i4,
', seed=', 4( i4,
',' ),
' type ',
878 $ i2,
', test(', i2,
')=', g10.3 )
subroutine xerbla(srname, info)
subroutine dchksb2stg(nsizes, nn, nwdths, kk, ntypes, dotype, iseed, thresh, nounit, a, lda, sd, se, d1, d2, d3, u, ldu, work, lwork, result, info)
DCHKSB2STG
subroutine dlasum(type, iounit, ie, nrun)
DLASUM
subroutine dlatmr(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)
DLATMR
subroutine dlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
DLATMS
subroutine dsbt21(uplo, n, ka, ks, a, lda, d, e, u, ldu, work, result)
DSBT21
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dsbtrd(vect, uplo, n, kd, ab, ldab, d, e, q, ldq, work, info)
DSBTRD
subroutine dsytrd_sb2st(stage1, vect, uplo, n, kd, ab, ldab, d, e, hous, lhous, work, lwork, info)
DSYTRD_SB2ST reduces a real symmetric band matrix A to real symmetric tridiagonal form T
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY 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 dsteqr(compz, n, d, e, z, ldz, work, info)
DSTEQR