366 SUBROUTINE cdrvsg( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
367 $ NOUNIT, A, LDA, B, LDB, D, Z, LDZ, AB, BB, AP,
368 $ BP, WORK, NWORK, RWORK, LRWORK, IWORK, LIWORK,
376 INTEGER INFO, LDA, LDB, LDZ, LIWORK, LRWORK, NOUNIT,
377 $ NSIZES, NTYPES, NWORK
382 INTEGER ISEED( 4 ), IWORK( * ), NN( * )
383 REAL D( * ), RESULT( * ), RWORK( * )
384 COMPLEX A( LDA, * ), AB( LDA, * ), AP( * ),
385 $ b( ldb, * ), bb( ldb, * ), bp( * ), work( * ),
393 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0, ten = 10.0e+0 )
395 parameter( czero = ( 0.0e+0, 0.0e+0 ),
396 $ cone = ( 1.0e+0, 0.0e+0 ) )
398 parameter( maxtyp = 21 )
403 INTEGER I, IBTYPE, IBUPLO, IINFO, IJ, IL, IMODE, ITEMP,
404 $ itype, iu, j, jcol, jsize, jtype, ka, ka9, kb,
405 $ kb9, m, mtypes, n, nerrs, nmats, nmax, ntest,
407 REAL ABSTOL, ANINV, ANORM, COND, OVFL, RTOVFL,
408 $ RTUNFL, ULP, ULPINV, UNFL, VL, VU
411 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), ISEED2( 4 ),
412 $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
418 EXTERNAL LSAME, SLAMCH, SLARND
426 INTRINSIC abs, max, min, real, sqrt
429 DATA ktype / 1, 2, 5*4, 5*5, 3*8, 6*9 /
430 DATA kmagn / 2*1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
432 DATA kmode / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
445 nmax = max( nmax, nn( j ) )
452 IF( nsizes.LT.0 )
THEN
454 ELSE IF( badnn )
THEN
456 ELSE IF( ntypes.LT.0 )
THEN
458 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
460 ELSE IF( ldz.LE.1 .OR. ldz.LT.nmax )
THEN
462 ELSE IF( 2*max( nmax, 2 )**2.GT.nwork )
THEN
464 ELSE IF( 2*max( nmax, 2 )**2.GT.lrwork )
THEN
466 ELSE IF( 2*max( nmax, 2 )**2.GT.liwork )
THEN
471 CALL xerbla(
'CDRVSG', -info )
477 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
482 unfl = slamch(
'Safe minimum' )
483 ovfl = slamch(
'Overflow' )
484 ulp = slamch(
'Epsilon' )*slamch(
'Base' )
486 rtunfl = sqrt( unfl )
487 rtovfl = sqrt( ovfl )
490 iseed2( i ) = iseed( i )
498 DO 650 jsize = 1, nsizes
500 aninv = one / real( max( 1, n ) )
502 IF( nsizes.NE.1 )
THEN
503 mtypes = min( maxtyp, ntypes )
505 mtypes = min( maxtyp+1, ntypes )
510 DO 640 jtype = 1, mtypes
511 IF( .NOT.dotype( jtype ) )
517 ioldsd( j ) = iseed( j )
535 IF( mtypes.GT.maxtyp )
538 itype = ktype( jtype )
539 imode = kmode( jtype )
543 GO TO ( 40, 50, 60 )kmagn( jtype )
550 anorm = ( rtovfl*ulp )*aninv
554 anorm = rtunfl*n*ulpinv
564 IF( itype.EQ.1 )
THEN
570 CALL claset(
'Full', lda, n, czero, czero, a, lda )
572 ELSE IF( itype.EQ.2 )
THEN
578 CALL claset(
'Full', lda, n, czero, czero, a, lda )
580 a( jcol, jcol ) = anorm
583 ELSE IF( itype.EQ.4 )
THEN
589 CALL clatms( n, n,
'S', iseed,
'H', rwork, imode, cond,
590 $ anorm, 0, 0,
'N', a, lda, work, iinfo )
592 ELSE IF( itype.EQ.5 )
THEN
598 CALL clatms( n, n,
'S', iseed,
'H', rwork, imode, cond,
599 $ anorm, n, n,
'N', a, lda, work, iinfo )
601 ELSE IF( itype.EQ.7 )
THEN
607 CALL clatmr( n, n,
'S', iseed,
'H', work, 6, one, cone,
608 $
'T',
'N', work( n+1 ), 1, one,
609 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
610 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
612 ELSE IF( itype.EQ.8 )
THEN
618 CALL clatmr( n, n,
'S', iseed,
'H', work, 6, one, cone,
619 $
'T',
'N', work( n+1 ), 1, one,
620 $ work( 2*n+1 ), 1, one,
'N', idumma, n, n,
621 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
623 ELSE IF( itype.EQ.9 )
THEN
637 IF( kb9.GT.ka9 )
THEN
641 ka = max( 0, min( n-1, ka9 ) )
642 kb = max( 0, min( n-1, kb9 ) )
643 CALL clatms( n, n,
'S', iseed,
'H', rwork, imode, cond,
644 $ anorm, ka, ka,
'N', a, lda, work, iinfo )
651 IF( iinfo.NE.0 )
THEN
652 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n, jtype,
665 il = 1 + int( ( n-1 )*slarnd( 1, iseed2 ) )
666 iu = 1 + int( ( n-1 )*slarnd( 1, iseed2 ) )
695 CALL clatms( n, n,
'U', iseed,
'P', rwork, 5, ten,
696 $ one, kb, kb, uplo, b, ldb, work( n+1 ),
703 CALL clacpy(
' ', n, n, a, lda, z, ldz )
704 CALL clacpy( uplo, n, n, b, ldb, bb, ldb )
706 CALL chegv( ibtype,
'V', uplo, n, z, ldz, bb, ldb, d,
707 $ work, nwork, rwork, iinfo )
708 IF( iinfo.NE.0 )
THEN
709 WRITE( nounit, fmt = 9999 )
'CHEGV(V,' // uplo //
710 $
')', iinfo, n, jtype, ioldsd
712 IF( iinfo.LT.0 )
THEN
715 result( ntest ) = ulpinv
722 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
723 $ ldz, d, work, rwork, result( ntest ) )
729 CALL clacpy(
' ', n, n, a, lda, z, ldz )
730 CALL clacpy( uplo, n, n, b, ldb, bb, ldb )
732 CALL chegvd( ibtype,
'V', uplo, n, z, ldz, bb, ldb, d,
733 $ work, nwork, rwork, lrwork, iwork,
735 IF( iinfo.NE.0 )
THEN
736 WRITE( nounit, fmt = 9999 )
'CHEGVD(V,' // uplo //
737 $
')', iinfo, n, jtype, ioldsd
739 IF( iinfo.LT.0 )
THEN
742 result( ntest ) = ulpinv
749 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
750 $ ldz, d, work, rwork, result( ntest ) )
756 CALL clacpy(
' ', n, n, a, lda, ab, lda )
757 CALL clacpy( uplo, n, n, b, ldb, bb, ldb )
759 CALL chegvx( ibtype,
'V',
'A', uplo, n, ab, lda, bb,
760 $ ldb, vl, vu, il, iu, abstol, m, d, z,
761 $ ldz, work, nwork, rwork, iwork( n+1 ),
763 IF( iinfo.NE.0 )
THEN
764 WRITE( nounit, fmt = 9999 )
'CHEGVX(V,A' // uplo //
765 $
')', iinfo, n, jtype, ioldsd
767 IF( iinfo.LT.0 )
THEN
770 result( ntest ) = ulpinv
777 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
778 $ ldz, d, work, rwork, result( ntest ) )
782 CALL clacpy(
' ', n, n, a, lda, ab, lda )
783 CALL clacpy( uplo, n, n, b, ldb, bb, ldb )
792 CALL chegvx( ibtype,
'V',
'V', uplo, n, ab, lda, bb,
793 $ ldb, vl, vu, il, iu, abstol, m, d, z,
794 $ ldz, work, nwork, rwork, iwork( n+1 ),
796 IF( iinfo.NE.0 )
THEN
797 WRITE( nounit, fmt = 9999 )
'CHEGVX(V,V,' //
798 $ uplo //
')', iinfo, n, jtype, ioldsd
800 IF( iinfo.LT.0 )
THEN
803 result( ntest ) = ulpinv
810 CALL csgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
811 $ ldz, d, work, rwork, result( ntest ) )
815 CALL clacpy(
' ', n, n, a, lda, ab, lda )
816 CALL clacpy( uplo, n, n, b, ldb, bb, ldb )
818 CALL chegvx( ibtype,
'V',
'I', uplo, n, ab, lda, bb,
819 $ ldb, vl, vu, il, iu, abstol, m, d, z,
820 $ ldz, work, nwork, rwork, iwork( n+1 ),
822 IF( iinfo.NE.0 )
THEN
823 WRITE( nounit, fmt = 9999 )
'CHEGVX(V,I,' //
824 $ uplo //
')', iinfo, n, jtype, ioldsd
826 IF( iinfo.LT.0 )
THEN
829 result( ntest ) = ulpinv
836 CALL csgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
837 $ ldz, d, work, rwork, result( ntest ) )
847 IF( lsame( uplo,
'U' ) )
THEN
867 CALL chpgv( ibtype,
'V', uplo, n, ap, bp, d, z, ldz,
868 $ work, rwork, iinfo )
869 IF( iinfo.NE.0 )
THEN
870 WRITE( nounit, fmt = 9999 )
'CHPGV(V,' // uplo //
871 $
')', iinfo, n, jtype, ioldsd
873 IF( iinfo.LT.0 )
THEN
876 result( ntest ) = ulpinv
883 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
884 $ ldz, d, work, rwork, result( ntest ) )
892 IF( lsame( uplo,
'U' ) )
THEN
912 CALL chpgvd( ibtype,
'V', uplo, n, ap, bp, d, z, ldz,
913 $ work, nwork, rwork, lrwork, iwork,
915 IF( iinfo.NE.0 )
THEN
916 WRITE( nounit, fmt = 9999 )
'CHPGVD(V,' // uplo //
917 $
')', iinfo, n, jtype, ioldsd
919 IF( iinfo.LT.0 )
THEN
922 result( ntest ) = ulpinv
929 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
930 $ ldz, d, work, rwork, result( ntest ) )
938 IF( lsame( uplo,
'U' ) )
THEN
958 CALL chpgvx( ibtype,
'V',
'A', uplo, n, ap, bp, vl,
959 $ vu, il, iu, abstol, m, d, z, ldz, work,
960 $ rwork, iwork( n+1 ), iwork, info )
961 IF( iinfo.NE.0 )
THEN
962 WRITE( nounit, fmt = 9999 )
'CHPGVX(V,A' // uplo //
963 $
')', iinfo, n, jtype, ioldsd
965 IF( iinfo.LT.0 )
THEN
968 result( ntest ) = ulpinv
975 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
976 $ ldz, d, work, rwork, result( ntest ) )
982 IF( lsame( uplo,
'U' ) )
THEN
1004 CALL chpgvx( ibtype,
'V',
'V', uplo, n, ap, bp, vl,
1005 $ vu, il, iu, abstol, m, d, z, ldz, work,
1006 $ rwork, iwork( n+1 ), iwork, info )
1007 IF( iinfo.NE.0 )
THEN
1008 WRITE( nounit, fmt = 9999 )
'CHPGVX(V,V' // uplo //
1009 $
')', iinfo, n, jtype, ioldsd
1011 IF( iinfo.LT.0 )
THEN
1014 result( ntest ) = ulpinv
1021 CALL csgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1022 $ ldz, d, work, rwork, result( ntest ) )
1028 IF( lsame( uplo,
'U' ) )
THEN
1032 ap( ij ) = a( i, j )
1033 bp( ij ) = b( i, j )
1041 ap( ij ) = a( i, j )
1042 bp( ij ) = b( i, j )
1048 CALL chpgvx( ibtype,
'V',
'I', uplo, n, ap, bp, vl,
1049 $ vu, il, iu, abstol, m, d, z, ldz, work,
1050 $ rwork, iwork( n+1 ), iwork, info )
1051 IF( iinfo.NE.0 )
THEN
1052 WRITE( nounit, fmt = 9999 )
'CHPGVX(V,I' // uplo //
1053 $
')', iinfo, n, jtype, ioldsd
1055 IF( iinfo.LT.0 )
THEN
1058 result( ntest ) = ulpinv
1065 CALL csgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1066 $ ldz, d, work, rwork, result( ntest ) )
1070 IF( ibtype.EQ.1 )
THEN
1078 IF( lsame( uplo,
'U' ) )
THEN
1080 DO 320 i = max( 1, j-ka ), j
1081 ab( ka+1+i-j, j ) = a( i, j )
1083 DO 330 i = max( 1, j-kb ), j
1084 bb( kb+1+i-j, j ) = b( i, j )
1089 DO 350 i = j, min( n, j+ka )
1090 ab( 1+i-j, j ) = a( i, j )
1092 DO 360 i = j, min( n, j+kb )
1093 bb( 1+i-j, j ) = b( i, j )
1098 CALL chbgv(
'V', uplo, n, ka, kb, ab, lda, bb, ldb,
1099 $ d, z, ldz, work, rwork, iinfo )
1100 IF( iinfo.NE.0 )
THEN
1101 WRITE( nounit, fmt = 9999 )
'CHBGV(V,' //
1102 $ uplo //
')', iinfo, n, jtype, ioldsd
1104 IF( iinfo.LT.0 )
THEN
1107 result( ntest ) = ulpinv
1114 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
1115 $ ldz, d, work, rwork, result( ntest ) )
1123 IF( lsame( uplo,
'U' ) )
THEN
1125 DO 380 i = max( 1, j-ka ), j
1126 ab( ka+1+i-j, j ) = a( i, j )
1128 DO 390 i = max( 1, j-kb ), j
1129 bb( kb+1+i-j, j ) = b( i, j )
1134 DO 410 i = j, min( n, j+ka )
1135 ab( 1+i-j, j ) = a( i, j )
1137 DO 420 i = j, min( n, j+kb )
1138 bb( 1+i-j, j ) = b( i, j )
1143 CALL chbgvd(
'V', uplo, n, ka, kb, ab, lda, bb,
1144 $ ldb, d, z, ldz, work, nwork, rwork,
1145 $ lrwork, iwork, liwork, iinfo )
1146 IF( iinfo.NE.0 )
THEN
1147 WRITE( nounit, fmt = 9999 )
'CHBGVD(V,' //
1148 $ uplo //
')', iinfo, n, jtype, ioldsd
1150 IF( iinfo.LT.0 )
THEN
1153 result( ntest ) = ulpinv
1160 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
1161 $ ldz, d, work, rwork, result( ntest ) )
1169 IF( lsame( uplo,
'U' ) )
THEN
1171 DO 440 i = max( 1, j-ka ), j
1172 ab( ka+1+i-j, j ) = a( i, j )
1174 DO 450 i = max( 1, j-kb ), j
1175 bb( kb+1+i-j, j ) = b( i, j )
1180 DO 470 i = j, min( n, j+ka )
1181 ab( 1+i-j, j ) = a( i, j )
1183 DO 480 i = j, min( n, j+kb )
1184 bb( 1+i-j, j ) = b( i, j )
1189 CALL chbgvx(
'V',
'A', uplo, n, ka, kb, ab, lda,
1190 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1191 $ iu, abstol, m, d, z, ldz, work, rwork,
1192 $ iwork( n+1 ), iwork, iinfo )
1193 IF( iinfo.NE.0 )
THEN
1194 WRITE( nounit, fmt = 9999 )
'CHBGVX(V,A' //
1195 $ uplo //
')', iinfo, n, jtype, ioldsd
1197 IF( iinfo.LT.0 )
THEN
1200 result( ntest ) = ulpinv
1207 CALL csgt01( ibtype, uplo, n, n, a, lda, b, ldb, z,
1208 $ ldz, d, work, rwork, result( ntest ) )
1214 IF( lsame( uplo,
'U' ) )
THEN
1216 DO 500 i = max( 1, j-ka ), j
1217 ab( ka+1+i-j, j ) = a( i, j )
1219 DO 510 i = max( 1, j-kb ), j
1220 bb( kb+1+i-j, j ) = b( i, j )
1225 DO 530 i = j, min( n, j+ka )
1226 ab( 1+i-j, j ) = a( i, j )
1228 DO 540 i = j, min( n, j+kb )
1229 bb( 1+i-j, j ) = b( i, j )
1236 CALL chbgvx(
'V',
'V', uplo, n, ka, kb, ab, lda,
1237 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1238 $ iu, abstol, m, d, z, ldz, work, rwork,
1239 $ iwork( n+1 ), iwork, iinfo )
1240 IF( iinfo.NE.0 )
THEN
1241 WRITE( nounit, fmt = 9999 )
'CHBGVX(V,V' //
1242 $ uplo //
')', iinfo, n, jtype, ioldsd
1244 IF( iinfo.LT.0 )
THEN
1247 result( ntest ) = ulpinv
1254 CALL csgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1255 $ ldz, d, work, rwork, result( ntest ) )
1261 IF( lsame( uplo,
'U' ) )
THEN
1263 DO 560 i = max( 1, j-ka ), j
1264 ab( ka+1+i-j, j ) = a( i, j )
1266 DO 570 i = max( 1, j-kb ), j
1267 bb( kb+1+i-j, j ) = b( i, j )
1272 DO 590 i = j, min( n, j+ka )
1273 ab( 1+i-j, j ) = a( i, j )
1275 DO 600 i = j, min( n, j+kb )
1276 bb( 1+i-j, j ) = b( i, j )
1281 CALL chbgvx(
'V',
'I', uplo, n, ka, kb, ab, lda,
1282 $ bb, ldb, bp, max( 1, n ), vl, vu, il,
1283 $ iu, abstol, m, d, z, ldz, work, rwork,
1284 $ iwork( n+1 ), iwork, iinfo )
1285 IF( iinfo.NE.0 )
THEN
1286 WRITE( nounit, fmt = 9999 )
'CHBGVX(V,I' //
1287 $ uplo //
')', iinfo, n, jtype, ioldsd
1289 IF( iinfo.LT.0 )
THEN
1292 result( ntest ) = ulpinv
1299 CALL csgt01( ibtype, uplo, n, m, a, lda, b, ldb, z,
1300 $ ldz, d, work, rwork, result( ntest ) )
1309 ntestt = ntestt + ntest
1310 CALL slafts(
'CSG', n, n, jtype, ntest, result, ioldsd,
1311 $ thresh, nounit, nerrs )
1317 CALL slasum(
'CSG', nounit, nerrs, ntestt )
1321 9999
FORMAT(
' CDRVSG: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
1322 $ i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )