352 SUBROUTINE ddrvsg( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
353 $ NOUNIT, A, LDA, B, LDB, D, Z, LDZ, AB, BB, AP,
354 $ BP, WORK, NWORK, IWORK, LIWORK, RESULT, INFO )
361 INTEGER INFO, LDA, LDB, LDZ, LIWORK, NOUNIT, NSIZES,
363 DOUBLE PRECISION THRESH
367 INTEGER ISEED( 4 ), IWORK( * ), NN( * )
368 DOUBLE PRECISION A( LDA, * ), AB( LDA, * ), AP( * ),
369 $ b( ldb, * ), bb( ldb, * ), bp( * ), d( * ),
370 $ result( * ), work( * ), z( ldz, * )
376 DOUBLE PRECISION ZERO, ONE, TEN
377 PARAMETER ( ZERO = 0.0d0, one = 1.0d0, ten = 10.0d0 )
379 parameter( maxtyp = 21 )
384 INTEGER I, IBTYPE, IBUPLO, IINFO, IJ, IL, IMODE, ITEMP,
385 $ itype, iu, j, jcol, jsize, jtype, ka, ka9, kb,
386 $ kb9, m, mtypes, n, nerrs, nmats, nmax, ntest,
388 DOUBLE PRECISION ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL,
389 $ RTUNFL, ULP, ULPINV, UNFL, VL, VU
392 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), ISEED2( 4 ),
393 $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
398 DOUBLE PRECISION DLAMCH, DLARND
399 EXTERNAL lsame, dlamch, dlarnd
407 INTRINSIC abs, dble, max, min, sqrt
410 DATA ktype / 1, 2, 5*4, 5*5, 3*8, 6*9 /
411 DATA kmagn / 2*1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
413 DATA kmode / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
426 nmax = max( nmax, nn( j ) )
433 IF( nsizes.LT.0 )
THEN
435 ELSE IF( badnn )
THEN
437 ELSE IF( ntypes.LT.0 )
THEN
439 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
441 ELSE IF( ldz.LE.1 .OR. ldz.LT.nmax )
THEN
443 ELSE IF( 2*max( nmax, 3 )**2.GT.nwork )
THEN
445 ELSE IF( 2*max( nmax, 3 )**2.GT.liwork )
THEN
450 CALL xerbla(
'DDRVSG', -info )
456 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
461 unfl = dlamch(
'Safe minimum' )
462 ovfl = dlamch(
'Overflow' )
463 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
465 rtunfl = sqrt( unfl )
466 rtovfl = sqrt( ovfl )
469 iseed2( i ) = iseed( i )
477 DO 650 jsize = 1, nsizes
479 aninv = one / dble( max( 1, n ) )
481 IF( nsizes.NE.1 )
THEN
482 mtypes = min( maxtyp, ntypes )
484 mtypes = min( maxtyp+1, ntypes )
489 DO 640 jtype = 1, mtypes
490 IF( .NOT.dotype( jtype ) )
496 ioldsd( j ) = iseed( j )
514 IF( mtypes.GT.maxtyp )
517 itype = ktype( jtype )
518 imode = kmode( jtype )
522 GO TO ( 40, 50, 60 )kmagn( jtype )
529 anorm = ( rtovfl*ulp )*aninv
533 anorm = rtunfl*n*ulpinv
543 IF( itype.EQ.1 )
THEN
549 CALL dlaset(
'Full', lda, n, zero, zero, a, lda )
551 ELSE IF( itype.EQ.2 )
THEN
557 CALL dlaset(
'Full', lda, n, zero, zero, a, lda )
559 a( jcol, jcol ) = anorm
562 ELSE IF( itype.EQ.4 )
THEN
568 CALL dlatms( n, n,
'S', iseed,
'S', work, imode, cond,
569 $ anorm, 0, 0,
'N', a, lda, work( n+1 ),
572 ELSE IF( itype.EQ.5 )
THEN
578 CALL dlatms( n, n,
'S', iseed,
'S', work, imode, cond,
579 $ anorm, n, n,
'N', a, lda, work( n+1 ),
582 ELSE IF( itype.EQ.7 )
THEN
588 CALL dlatmr( n, n,
'S', iseed,
'S', work, 6, one, one,
589 $
'T',
'N', work( n+1 ), 1, one,
590 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
591 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
593 ELSE IF( itype.EQ.8 )
THEN
599 CALL dlatmr( n, n,
'S', iseed,
'H', work, 6, one, one,
600 $
'T',
'N', work( n+1 ), 1, one,
601 $ work( 2*n+1 ), 1, one,
'N', idumma, n, n,
602 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
604 ELSE IF( itype.EQ.9 )
THEN
618 IF( kb9.GT.ka9 )
THEN
622 ka = max( 0, min( n-1, ka9 ) )
623 kb = max( 0, min( n-1, kb9 ) )
624 CALL dlatms( n, n,
'S', iseed,
'S', work, imode, cond,
625 $ anorm, ka, ka,
'N', a, lda, work( n+1 ),
633 IF( iinfo.NE.0 )
THEN
634 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n, jtype,
647 il = 1 + int( ( n-1 )*dlarnd( 1, iseed2 ) )
648 iu = 1 + int( ( n-1 )*dlarnd( 1, iseed2 ) )
677 CALL dlatms( n, n,
'U', iseed,
'P', work, 5, ten, one,
678 $ kb, kb, uplo, b, ldb, work( n+1 ),
685 CALL dlacpy(
' ', n, n, a, lda, z, ldz )
686 CALL dlacpy( uplo, n, n, b, ldb, bb, ldb )
688 CALL dsygv( ibtype,
'V', uplo, n, z, ldz, bb, ldb, d,
689 $ work, nwork, iinfo )
690 IF( iinfo.NE.0 )
THEN
691 WRITE( nounit, fmt = 9999 )
'DSYGV(V,' // uplo //
692 $
')', iinfo, n, jtype, ioldsd
694 IF( iinfo.LT.0 )
THEN
697 result( ntest ) = ulpinv
704 CALL dsgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
705 $ ldz, d, work, result( ntest ) )
711 CALL dlacpy(
' ', n, n, a, lda, z, ldz )
712 CALL dlacpy( uplo, n, n, b, ldb, bb, ldb )
714 CALL dsygvd( ibtype,
'V', uplo, n, z, ldz, bb, ldb, d,
715 $ work, nwork, iwork, liwork, iinfo )
716 IF( iinfo.NE.0 )
THEN
717 WRITE( nounit, fmt = 9999 )
'DSYGVD(V,' // uplo //
718 $
')', iinfo, n, jtype, ioldsd
720 IF( iinfo.LT.0 )
THEN
723 result( ntest ) = ulpinv
730 CALL dsgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
731 $ ldz, d, work, result( ntest ) )
737 CALL dlacpy(
' ', n, n, a, lda, ab, lda )
738 CALL dlacpy( uplo, n, n, b, ldb, bb, ldb )
740 CALL dsygvx( ibtype,
'V',
'A', uplo, n, ab, lda, bb,
741 $ ldb, vl, vu, il, iu, abstol, m, d, z,
742 $ ldz, work, nwork, iwork( n+1 ), iwork,
744 IF( iinfo.NE.0 )
THEN
745 WRITE( nounit, fmt = 9999 )
'DSYGVX(V,A' // uplo //
746 $
')', iinfo, n, jtype, ioldsd
748 IF( iinfo.LT.0 )
THEN
751 result( ntest ) = ulpinv
758 CALL dsgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
759 $ ldz, d, work, result( ntest ) )
763 CALL dlacpy(
' ', n, n, a, lda, ab, lda )
764 CALL dlacpy( uplo, n, n, b, ldb, bb, ldb )
773 CALL dsygvx( ibtype,
'V',
'V', uplo, n, ab, lda, bb,
774 $ ldb, vl, vu, il, iu, abstol, m, d, z,
775 $ ldz, work, nwork, iwork( n+1 ), iwork,
777 IF( iinfo.NE.0 )
THEN
778 WRITE( nounit, fmt = 9999 )
'DSYGVX(V,V,' //
779 $ uplo //
')', iinfo, n, jtype, ioldsd
781 IF( iinfo.LT.0 )
THEN
784 result( ntest ) = ulpinv
791 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
792 $ ldz, d, work, result( ntest ) )
796 CALL dlacpy(
' ', n, n, a, lda, ab, lda )
797 CALL dlacpy( uplo, n, n, b, ldb, bb, ldb )
799 CALL dsygvx( ibtype,
'V',
'I', uplo, n, ab, lda, bb,
800 $ ldb, vl, vu, il, iu, abstol, m, d, z,
801 $ ldz, work, nwork, iwork( n+1 ), iwork,
803 IF( iinfo.NE.0 )
THEN
804 WRITE( nounit, fmt = 9999 )
'DSYGVX(V,I,' //
805 $ uplo //
')', iinfo, n, jtype, ioldsd
807 IF( iinfo.LT.0 )
THEN
810 result( ntest ) = ulpinv
817 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
818 $ ldz, d, work, result( ntest ) )
828 IF( lsame( uplo,
'U' ) )
THEN
848 CALL dspgv( ibtype,
'V', uplo, n, ap, bp, d, z, ldz,
850 IF( iinfo.NE.0 )
THEN
851 WRITE( nounit, fmt = 9999 )
'DSPGV(V,' // uplo //
852 $
')', iinfo, n, jtype, ioldsd
854 IF( iinfo.LT.0 )
THEN
857 result( ntest ) = ulpinv
864 CALL dsgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
865 $ ldz, d, work, result( ntest ) )
873 IF( lsame( uplo,
'U' ) )
THEN
893 CALL dspgvd( ibtype,
'V', uplo, n, ap, bp, d, z, ldz,
894 $ work, nwork, iwork, liwork, iinfo )
895 IF( iinfo.NE.0 )
THEN
896 WRITE( nounit, fmt = 9999 )
'DSPGVD(V,' // uplo //
897 $
')', iinfo, n, jtype, ioldsd
899 IF( iinfo.LT.0 )
THEN
902 result( ntest ) = ulpinv
909 CALL dsgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
910 $ ldz, d, work, result( ntest ) )
918 IF( lsame( uplo,
'U' ) )
THEN
938 CALL dspgvx( ibtype,
'V',
'A', uplo, n, ap, bp, vl,
939 $ vu, il, iu, abstol, m, d, z, ldz, work,
940 $ iwork( n+1 ), iwork, info )
941 IF( iinfo.NE.0 )
THEN
942 WRITE( nounit, fmt = 9999 )
'DSPGVX(V,A' // uplo //
943 $
')', iinfo, n, jtype, ioldsd
945 IF( iinfo.LT.0 )
THEN
948 result( ntest ) = ulpinv
955 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
956 $ ldz, d, work, result( ntest ) )
962 IF( lsame( uplo,
'U' ) )
THEN
984 CALL dspgvx( ibtype,
'V',
'V', uplo, n, ap, bp, vl,
985 $ vu, il, iu, abstol, m, d, z, ldz, work,
986 $ iwork( n+1 ), iwork, info )
987 IF( iinfo.NE.0 )
THEN
988 WRITE( nounit, fmt = 9999 )
'DSPGVX(V,V' // uplo //
989 $
')', iinfo, n, jtype, ioldsd
991 IF( iinfo.LT.0 )
THEN
994 result( ntest ) = ulpinv
1001 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1002 $ ldz, d, work, result( ntest ) )
1008 IF( lsame( uplo,
'U' ) )
THEN
1012 ap( ij ) = a( i, j )
1013 bp( ij ) = b( i, j )
1021 ap( ij ) = a( i, j )
1022 bp( ij ) = b( i, j )
1028 CALL dspgvx( ibtype,
'V',
'I', uplo, n, ap, bp, vl,
1029 $ vu, il, iu, abstol, m, d, z, ldz, work,
1030 $ iwork( n+1 ), iwork, info )
1031 IF( iinfo.NE.0 )
THEN
1032 WRITE( nounit, fmt = 9999 )
'DSPGVX(V,I' // uplo //
1033 $
')', iinfo, n, jtype, ioldsd
1035 IF( iinfo.LT.0 )
THEN
1038 result( ntest ) = ulpinv
1045 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1046 $ ldz, d, work, result( ntest ) )
1050 IF( ibtype.EQ.1 )
THEN
1058 IF( lsame( uplo,
'U' ) )
THEN
1060 DO 320 i = max( 1, j-ka ), j
1061 ab( ka+1+i-j, j ) = a( i, j )
1063 DO 330 i = max( 1, j-kb ), j
1064 bb( kb+1+i-j, j ) = b( i, j )
1069 DO 350 i = j, min( n, j+ka )
1070 ab( 1+i-j, j ) = a( i, j )
1072 DO 360 i = j, min( n, j+kb )
1073 bb( 1+i-j, j ) = b( i, j )
1078 CALL dsbgv(
'V', uplo, n, ka, kb, ab, lda, bb, ldb,
1079 $ d, z, ldz, work, iinfo )
1080 IF( iinfo.NE.0 )
THEN
1081 WRITE( nounit, fmt = 9999 )
'DSBGV(V,' //
1082 $ uplo //
')', iinfo, n, jtype, ioldsd
1084 IF( iinfo.LT.0 )
THEN
1087 result( ntest ) = ulpinv
1094 CALL dsgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
1095 $ ldz, d, work, result( ntest ) )
1103 IF( lsame( uplo,
'U' ) )
THEN
1105 DO 380 i = max( 1, j-ka ), j
1106 ab( ka+1+i-j, j ) = a( i, j )
1108 DO 390 i = max( 1, j-kb ), j
1109 bb( kb+1+i-j, j ) = b( i, j )
1114 DO 410 i = j, min( n, j+ka )
1115 ab( 1+i-j, j ) = a( i, j )
1117 DO 420 i = j, min( n, j+kb )
1118 bb( 1+i-j, j ) = b( i, j )
1123 CALL dsbgvd(
'V', uplo, n, ka, kb, ab, lda, bb,
1124 $ ldb, d, z, ldz, work, nwork, iwork,
1126 IF( iinfo.NE.0 )
THEN
1127 WRITE( nounit, fmt = 9999 )
'DSBGVD(V,' //
1128 $ uplo //
')', iinfo, n, jtype, ioldsd
1130 IF( iinfo.LT.0 )
THEN
1133 result( ntest ) = ulpinv
1140 CALL dsgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
1141 $ ldz, d, work, result( ntest ) )
1149 IF( lsame( uplo,
'U' ) )
THEN
1151 DO 440 i = max( 1, j-ka ), j
1152 ab( ka+1+i-j, j ) = a( i, j )
1154 DO 450 i = max( 1, j-kb ), j
1155 bb( kb+1+i-j, j ) = b( i, j )
1160 DO 470 i = j, min( n, j+ka )
1161 ab( 1+i-j, j ) = a( i, j )
1163 DO 480 i = j, min( n, j+kb )
1164 bb( 1+i-j, j ) = b( i, j )
1169 CALL dsbgvx(
'V',
'A', uplo, n, ka, kb, ab, lda,
1170 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1171 $ iu, abstol, m, d, z, ldz, work,
1172 $ iwork( n+1 ), iwork, iinfo )
1173 IF( iinfo.NE.0 )
THEN
1174 WRITE( nounit, fmt = 9999 )
'DSBGVX(V,A' //
1175 $ uplo //
')', iinfo, n, jtype, ioldsd
1177 IF( iinfo.LT.0 )
THEN
1180 result( ntest ) = ulpinv
1187 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1188 $ ldz, d, work, result( ntest ) )
1195 IF( lsame( uplo,
'U' ) )
THEN
1197 DO 500 i = max( 1, j-ka ), j
1198 ab( ka+1+i-j, j ) = a( i, j )
1200 DO 510 i = max( 1, j-kb ), j
1201 bb( kb+1+i-j, j ) = b( i, j )
1206 DO 530 i = j, min( n, j+ka )
1207 ab( 1+i-j, j ) = a( i, j )
1209 DO 540 i = j, min( n, j+kb )
1210 bb( 1+i-j, j ) = b( i, j )
1217 CALL dsbgvx(
'V',
'V', uplo, n, ka, kb, ab, lda,
1218 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1219 $ iu, abstol, m, d, z, ldz, work,
1220 $ iwork( n+1 ), iwork, iinfo )
1221 IF( iinfo.NE.0 )
THEN
1222 WRITE( nounit, fmt = 9999 )
'DSBGVX(V,V' //
1223 $ uplo //
')', iinfo, n, jtype, ioldsd
1225 IF( iinfo.LT.0 )
THEN
1228 result( ntest ) = ulpinv
1235 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1236 $ ldz, d, work, result( ntest ) )
1242 IF( lsame( uplo,
'U' ) )
THEN
1244 DO 560 i = max( 1, j-ka ), j
1245 ab( ka+1+i-j, j ) = a( i, j )
1247 DO 570 i = max( 1, j-kb ), j
1248 bb( kb+1+i-j, j ) = b( i, j )
1253 DO 590 i = j, min( n, j+ka )
1254 ab( 1+i-j, j ) = a( i, j )
1256 DO 600 i = j, min( n, j+kb )
1257 bb( 1+i-j, j ) = b( i, j )
1262 CALL dsbgvx(
'V',
'I', uplo, n, ka, kb, ab, lda,
1263 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1264 $ iu, abstol, m, d, z, ldz, work,
1265 $ iwork( n+1 ), iwork, iinfo )
1266 IF( iinfo.NE.0 )
THEN
1267 WRITE( nounit, fmt = 9999 )
'DSBGVX(V,I' //
1268 $ uplo //
')', iinfo, n, jtype, ioldsd
1270 IF( iinfo.LT.0 )
THEN
1273 result( ntest ) = ulpinv
1280 CALL dsgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1281 $ ldz, d, work, result( ntest ) )
1290 ntestt = ntestt + ntest
1291 CALL dlafts(
'DSG', n, n, jtype, ntest, result, ioldsd,
1292 $ thresh, nounit, nerrs )
1298 CALL dlasum(
'DSG', nounit, nerrs, ntestt )
1304 9999
FORMAT(
' DDRVSG: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
1305 $ i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )