358 SUBROUTINE sdrvsg2stg( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
359 $ NOUNIT, A, LDA, B, LDB, D, D2, Z, LDZ, AB,
360 $ BB, AP, BP, WORK, NWORK, IWORK, LIWORK,
370 INTEGER INFO, LDA, LDB, LDZ, LIWORK, NOUNIT, NSIZES,
376 INTEGER ISEED( 4 ), IWORK( * ), NN( * )
377 REAL A( LDA, * ), AB( LDA, * ), AP( * ),
378 $ b( ldb, * ), bb( ldb, * ), bp( * ), d( * ),
379 $ d2( * ), result( * ), work( * ), z( ldz, * )
386 PARAMETER ( ZERO = 0.0e0, one = 1.0e0, ten = 10.0e0 )
388 parameter( maxtyp = 21 )
393 INTEGER I, IBTYPE, IBUPLO, IINFO, IJ, IL, IMODE, ITEMP,
394 $ itype, iu, j, jcol, jsize, jtype, ka, ka9, kb,
395 $ kb9, m, mtypes, n, nerrs, nmats, nmax, ntest,
397 REAL ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL,
398 $ RTUNFL, ULP, ULPINV, UNFL, VL, VU, TEMP1, TEMP2
401 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), ISEED2( 4 ),
402 $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
408 EXTERNAL LSAME, SLAMCH, SLARND
417 INTRINSIC abs, real, max, min, sqrt
420 DATA ktype / 1, 2, 5*4, 5*5, 3*8, 6*9 /
421 DATA kmagn / 2*1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
423 DATA kmode / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
436 nmax = max( nmax, nn( j ) )
443 IF( nsizes.LT.0 )
THEN
445 ELSE IF( badnn )
THEN
447 ELSE IF( ntypes.LT.0 )
THEN
449 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
451 ELSE IF( ldz.LE.1 .OR. ldz.LT.nmax )
THEN
453 ELSE IF( 2*max( nmax, 3 )**2.GT.nwork )
THEN
455 ELSE IF( 2*max( nmax, 3 )**2.GT.liwork )
THEN
460 CALL xerbla(
'SDRVSG2STG', -info )
466 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
471 unfl = slamch(
'Safe minimum' )
472 ovfl = slamch(
'Overflow' )
473 ulp = slamch(
'Epsilon' )*slamch(
'Base' )
475 rtunfl = sqrt( unfl )
476 rtovfl = sqrt( ovfl )
479 iseed2( i ) = iseed( i )
487 DO 650 jsize = 1, nsizes
489 aninv = one / real( max( 1, n ) )
491 IF( nsizes.NE.1 )
THEN
492 mtypes = min( maxtyp, ntypes )
494 mtypes = min( maxtyp+1, ntypes )
499 DO 640 jtype = 1, mtypes
500 IF( .NOT.dotype( jtype ) )
506 ioldsd( j ) = iseed( j )
524 IF( mtypes.GT.maxtyp )
527 itype = ktype( jtype )
528 imode = kmode( jtype )
532 GO TO ( 40, 50, 60 )kmagn( jtype )
539 anorm = ( rtovfl*ulp )*aninv
543 anorm = rtunfl*n*ulpinv
553 IF( itype.EQ.1 )
THEN
559 CALL slaset(
'Full', lda, n, zero, zero, a, lda )
561 ELSE IF( itype.EQ.2 )
THEN
567 CALL slaset(
'Full', lda, n, zero, zero, a, lda )
569 a( jcol, jcol ) = anorm
572 ELSE IF( itype.EQ.4 )
THEN
578 CALL slatms( n, n,
'S', iseed,
'S', work, imode, cond,
579 $ anorm, 0, 0,
'N', a, lda, work( n+1 ),
582 ELSE IF( itype.EQ.5 )
THEN
588 CALL slatms( n, n,
'S', iseed,
'S', work, imode, cond,
589 $ anorm, n, n,
'N', a, lda, work( n+1 ),
592 ELSE IF( itype.EQ.7 )
THEN
598 CALL slatmr( n, n,
'S', iseed,
'S', work, 6, one, one,
599 $
'T',
'N', work( n+1 ), 1, one,
600 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
601 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
603 ELSE IF( itype.EQ.8 )
THEN
609 CALL slatmr( n, n,
'S', iseed,
'H', work, 6, one, one,
610 $
'T',
'N', work( n+1 ), 1, one,
611 $ work( 2*n+1 ), 1, one,
'N', idumma, n, n,
612 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
614 ELSE IF( itype.EQ.9 )
THEN
628 IF( kb9.GT.ka9 )
THEN
632 ka = max( 0, min( n-1, ka9 ) )
633 kb = max( 0, min( n-1, kb9 ) )
634 CALL slatms( n, n,
'S', iseed,
'S', work, imode, cond,
635 $ anorm, ka, ka,
'N', a, lda, work( n+1 ),
643 IF( iinfo.NE.0 )
THEN
644 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n, jtype,
657 il = 1 + int( ( n-1 )*slarnd( 1, iseed2 ) )
658 iu = 1 + int( ( n-1 )*slarnd( 1, iseed2 ) )
687 CALL slatms( n, n,
'U', iseed,
'P', work, 5, ten, one,
688 $ kb, kb, uplo, b, ldb, work( n+1 ),
695 CALL slacpy(
' ', n, n, a, lda, z, ldz )
696 CALL slacpy( uplo, n, n, b, ldb, bb, ldb )
698 CALL ssygv( ibtype,
'V', uplo, n, z, ldz, bb, ldb, d,
699 $ work, nwork, iinfo )
700 IF( iinfo.NE.0 )
THEN
701 WRITE( nounit, fmt = 9999 )
'SSYGV(V,' // uplo //
702 $
')', iinfo, n, jtype, ioldsd
704 IF( iinfo.LT.0 )
THEN
707 result( ntest ) = ulpinv
714 CALL ssgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
715 $ ldz, d, work, result( ntest ) )
721 CALL slacpy(
' ', n, n, a, lda, z, ldz )
722 CALL slacpy( uplo, n, n, b, ldb, bb, ldb )
725 $ bb, ldb, d2, work, nwork, iinfo )
726 IF( iinfo.NE.0 )
THEN
727 WRITE( nounit, fmt = 9999 )
728 $
'SSYGV_2STAGE(V,' // uplo //
729 $
')', iinfo, n, jtype, ioldsd
731 IF( iinfo.LT.0 )
THEN
734 result( ntest ) = ulpinv
752 temp1 = max( temp1, abs( d( j ) ),
754 temp2 = max( temp2, abs( d( j )-d2( j ) ) )
757 result( ntest ) = temp2 /
758 $ max( unfl, ulp*max( temp1, temp2 ) )
764 CALL slacpy(
' ', n, n, a, lda, z, ldz )
765 CALL slacpy( uplo, n, n, b, ldb, bb, ldb )
767 CALL ssygvd( ibtype,
'V', uplo, n, z, ldz, bb, ldb, d,
768 $ work, nwork, iwork, liwork, iinfo )
769 IF( iinfo.NE.0 )
THEN
770 WRITE( nounit, fmt = 9999 )
'SSYGVD(V,' // uplo //
771 $
')', iinfo, n, jtype, ioldsd
773 IF( iinfo.LT.0 )
THEN
776 result( ntest ) = ulpinv
783 CALL ssgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
784 $ ldz, d, work, result( ntest ) )
790 CALL slacpy(
' ', n, n, a, lda, ab, lda )
791 CALL slacpy( uplo, n, n, b, ldb, bb, ldb )
793 CALL ssygvx( ibtype,
'V',
'A', uplo, n, ab, lda, bb,
794 $ ldb, vl, vu, il, iu, abstol, m, d, z,
795 $ ldz, work, nwork, iwork( n+1 ), iwork,
797 IF( iinfo.NE.0 )
THEN
798 WRITE( nounit, fmt = 9999 )
'SSYGVX(V,A' // uplo //
799 $
')', iinfo, n, jtype, ioldsd
801 IF( iinfo.LT.0 )
THEN
804 result( ntest ) = ulpinv
811 CALL ssgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
812 $ ldz, d, work, result( ntest ) )
816 CALL slacpy(
' ', n, n, a, lda, ab, lda )
817 CALL slacpy( uplo, n, n, b, ldb, bb, ldb )
826 CALL ssygvx( ibtype,
'V',
'V', uplo, n, ab, lda, bb,
827 $ ldb, vl, vu, il, iu, abstol, m, d, z,
828 $ ldz, work, nwork, iwork( n+1 ), iwork,
830 IF( iinfo.NE.0 )
THEN
831 WRITE( nounit, fmt = 9999 )
'SSYGVX(V,V,' //
832 $ uplo //
')', iinfo, n, jtype, ioldsd
834 IF( iinfo.LT.0 )
THEN
837 result( ntest ) = ulpinv
844 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
845 $ ldz, d, work, result( ntest ) )
849 CALL slacpy(
' ', n, n, a, lda, ab, lda )
850 CALL slacpy( uplo, n, n, b, ldb, bb, ldb )
852 CALL ssygvx( ibtype,
'V',
'I', uplo, n, ab, lda, bb,
853 $ ldb, vl, vu, il, iu, abstol, m, d, z,
854 $ ldz, work, nwork, iwork( n+1 ), iwork,
856 IF( iinfo.NE.0 )
THEN
857 WRITE( nounit, fmt = 9999 )
'SSYGVX(V,I,' //
858 $ uplo //
')', iinfo, n, jtype, ioldsd
860 IF( iinfo.LT.0 )
THEN
863 result( ntest ) = ulpinv
870 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
871 $ ldz, d, work, result( ntest ) )
881 IF( lsame( uplo,
'U' ) )
THEN
901 CALL sspgv( ibtype,
'V', uplo, n, ap, bp, d, z, ldz,
903 IF( iinfo.NE.0 )
THEN
904 WRITE( nounit, fmt = 9999 )
'SSPGV(V,' // uplo //
905 $
')', iinfo, n, jtype, ioldsd
907 IF( iinfo.LT.0 )
THEN
910 result( ntest ) = ulpinv
917 CALL ssgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
918 $ ldz, d, work, result( ntest ) )
926 IF( lsame( uplo,
'U' ) )
THEN
946 CALL sspgvd( ibtype,
'V', uplo, n, ap, bp, d, z, ldz,
947 $ work, nwork, iwork, liwork, iinfo )
948 IF( iinfo.NE.0 )
THEN
949 WRITE( nounit, fmt = 9999 )
'SSPGVD(V,' // uplo //
950 $
')', iinfo, n, jtype, ioldsd
952 IF( iinfo.LT.0 )
THEN
955 result( ntest ) = ulpinv
962 CALL ssgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
963 $ ldz, d, work, result( ntest ) )
971 IF( lsame( uplo,
'U' ) )
THEN
991 CALL sspgvx( ibtype,
'V',
'A', uplo, n, ap, bp, vl,
992 $ vu, il, iu, abstol, m, d, z, ldz, work,
993 $ iwork( n+1 ), iwork, info )
994 IF( iinfo.NE.0 )
THEN
995 WRITE( nounit, fmt = 9999 )
'SSPGVX(V,A' // uplo //
996 $
')', iinfo, n, jtype, ioldsd
998 IF( iinfo.LT.0 )
THEN
1001 result( ntest ) = ulpinv
1008 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1009 $ ldz, d, work, result( ntest ) )
1015 IF( lsame( uplo,
'U' ) )
THEN
1019 ap( ij ) = a( i, j )
1020 bp( ij ) = b( i, j )
1028 ap( ij ) = a( i, j )
1029 bp( ij ) = b( i, j )
1037 CALL sspgvx( ibtype,
'V',
'V', uplo, n, ap, bp, vl,
1038 $ vu, il, iu, abstol, m, d, z, ldz, work,
1039 $ iwork( n+1 ), iwork, info )
1040 IF( iinfo.NE.0 )
THEN
1041 WRITE( nounit, fmt = 9999 )
'SSPGVX(V,V' // uplo //
1042 $
')', iinfo, n, jtype, ioldsd
1044 IF( iinfo.LT.0 )
THEN
1047 result( ntest ) = ulpinv
1054 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1055 $ ldz, d, work, result( ntest ) )
1061 IF( lsame( uplo,
'U' ) )
THEN
1065 ap( ij ) = a( i, j )
1066 bp( ij ) = b( i, j )
1074 ap( ij ) = a( i, j )
1075 bp( ij ) = b( i, j )
1081 CALL sspgvx( ibtype,
'V',
'I', uplo, n, ap, bp, vl,
1082 $ vu, il, iu, abstol, m, d, z, ldz, work,
1083 $ iwork( n+1 ), iwork, info )
1084 IF( iinfo.NE.0 )
THEN
1085 WRITE( nounit, fmt = 9999 )
'SSPGVX(V,I' // uplo //
1086 $
')', iinfo, n, jtype, ioldsd
1088 IF( iinfo.LT.0 )
THEN
1091 result( ntest ) = ulpinv
1098 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1099 $ ldz, d, work, result( ntest ) )
1103 IF( ibtype.EQ.1 )
THEN
1111 IF( lsame( uplo,
'U' ) )
THEN
1113 DO 320 i = max( 1, j-ka ), j
1114 ab( ka+1+i-j, j ) = a( i, j )
1116 DO 330 i = max( 1, j-kb ), j
1117 bb( kb+1+i-j, j ) = b( i, j )
1122 DO 350 i = j, min( n, j+ka )
1123 ab( 1+i-j, j ) = a( i, j )
1125 DO 360 i = j, min( n, j+kb )
1126 bb( 1+i-j, j ) = b( i, j )
1131 CALL ssbgv(
'V', uplo, n, ka, kb, ab, lda, bb, ldb,
1132 $ d, z, ldz, work, iinfo )
1133 IF( iinfo.NE.0 )
THEN
1134 WRITE( nounit, fmt = 9999 )
'SSBGV(V,' //
1135 $ uplo //
')', iinfo, n, jtype, ioldsd
1137 IF( iinfo.LT.0 )
THEN
1140 result( ntest ) = ulpinv
1147 CALL ssgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
1148 $ ldz, d, work, result( ntest ) )
1156 IF( lsame( uplo,
'U' ) )
THEN
1158 DO 380 i = max( 1, j-ka ), j
1159 ab( ka+1+i-j, j ) = a( i, j )
1161 DO 390 i = max( 1, j-kb ), j
1162 bb( kb+1+i-j, j ) = b( i, j )
1167 DO 410 i = j, min( n, j+ka )
1168 ab( 1+i-j, j ) = a( i, j )
1170 DO 420 i = j, min( n, j+kb )
1171 bb( 1+i-j, j ) = b( i, j )
1176 CALL ssbgvd(
'V', uplo, n, ka, kb, ab, lda, bb,
1177 $ ldb, d, z, ldz, work, nwork, iwork,
1179 IF( iinfo.NE.0 )
THEN
1180 WRITE( nounit, fmt = 9999 )
'SSBGVD(V,' //
1181 $ uplo //
')', iinfo, n, jtype, ioldsd
1183 IF( iinfo.LT.0 )
THEN
1186 result( ntest ) = ulpinv
1193 CALL ssgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
1194 $ ldz, d, work, result( ntest ) )
1202 IF( lsame( uplo,
'U' ) )
THEN
1204 DO 440 i = max( 1, j-ka ), j
1205 ab( ka+1+i-j, j ) = a( i, j )
1207 DO 450 i = max( 1, j-kb ), j
1208 bb( kb+1+i-j, j ) = b( i, j )
1213 DO 470 i = j, min( n, j+ka )
1214 ab( 1+i-j, j ) = a( i, j )
1216 DO 480 i = j, min( n, j+kb )
1217 bb( 1+i-j, j ) = b( i, j )
1222 CALL ssbgvx(
'V',
'A', uplo, n, ka, kb, ab, lda,
1223 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1224 $ iu, abstol, m, d, z, ldz, work,
1225 $ iwork( n+1 ), iwork, iinfo )
1226 IF( iinfo.NE.0 )
THEN
1227 WRITE( nounit, fmt = 9999 )
'SSBGVX(V,A' //
1228 $ uplo //
')', iinfo, n, jtype, ioldsd
1230 IF( iinfo.LT.0 )
THEN
1233 result( ntest ) = ulpinv
1240 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1241 $ ldz, d, work, result( ntest ) )
1248 IF( lsame( uplo,
'U' ) )
THEN
1250 DO 500 i = max( 1, j-ka ), j
1251 ab( ka+1+i-j, j ) = a( i, j )
1253 DO 510 i = max( 1, j-kb ), j
1254 bb( kb+1+i-j, j ) = b( i, j )
1259 DO 530 i = j, min( n, j+ka )
1260 ab( 1+i-j, j ) = a( i, j )
1262 DO 540 i = j, min( n, j+kb )
1263 bb( 1+i-j, j ) = b( i, j )
1270 CALL ssbgvx(
'V',
'V', uplo, n, ka, kb, ab, lda,
1271 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1272 $ iu, abstol, m, d, z, ldz, work,
1273 $ iwork( n+1 ), iwork, iinfo )
1274 IF( iinfo.NE.0 )
THEN
1275 WRITE( nounit, fmt = 9999 )
'SSBGVX(V,V' //
1276 $ uplo //
')', iinfo, n, jtype, ioldsd
1278 IF( iinfo.LT.0 )
THEN
1281 result( ntest ) = ulpinv
1288 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1289 $ ldz, d, work, result( ntest ) )
1295 IF( lsame( uplo,
'U' ) )
THEN
1297 DO 560 i = max( 1, j-ka ), j
1298 ab( ka+1+i-j, j ) = a( i, j )
1300 DO 570 i = max( 1, j-kb ), j
1301 bb( kb+1+i-j, j ) = b( i, j )
1306 DO 590 i = j, min( n, j+ka )
1307 ab( 1+i-j, j ) = a( i, j )
1309 DO 600 i = j, min( n, j+kb )
1310 bb( 1+i-j, j ) = b( i, j )
1315 CALL ssbgvx(
'V',
'I', uplo, n, ka, kb, ab, lda,
1316 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1317 $ iu, abstol, m, d, z, ldz, work,
1318 $ iwork( n+1 ), iwork, iinfo )
1319 IF( iinfo.NE.0 )
THEN
1320 WRITE( nounit, fmt = 9999 )
'SSBGVX(V,I' //
1321 $ uplo //
')', iinfo, n, jtype, ioldsd
1323 IF( iinfo.LT.0 )
THEN
1326 result( ntest ) = ulpinv
1333 CALL ssgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1334 $ ldz, d, work, result( ntest ) )
1343 ntestt = ntestt + ntest
1344 CALL slafts(
'SSG', n, n, jtype, ntest, result, ioldsd,
1345 $ thresh, nounit, nerrs )
1351 CALL slasum(
'SSG', nounit, nerrs, ntestt )
1357 9999
FORMAT(
' SDRVSG2STG: ', a,
' returned INFO=', i6,
'.', / 9x,
1358 $
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )