486 SUBROUTINE zlatmr( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
487 $ RSIGN, GRADE, DL, MODEL, CONDL, DR, MODER,
488 $ CONDR, PIVTNG, IPIVOT, KL, KU, SPARSE, ANORM,
489 $ PACK, A, LDA, IWORK, INFO )
496 CHARACTER DIST, GRADE, PACK, PIVTNG, RSIGN, SYM
497 INTEGER INFO, KL, KU, LDA, M, MODE, MODEL, MODER, N
498 DOUBLE PRECISION ANORM, COND, CONDL, CONDR, SPARSE
502 INTEGER IPIVOT( * ), ISEED( 4 ), IWORK( * )
503 COMPLEX*16 A( LDA, * ), D( * ), DL( * ), DR( * )
509 DOUBLE PRECISION ZERO
510 PARAMETER ( ZERO = 0.0d0 )
512 parameter( one = 1.0d0 )
514 parameter( cone = ( 1.0d0, 0.0d0 ) )
516 parameter( czero = ( 0.0d0, 0.0d0 ) )
519 LOGICAL BADPVT, DZERO, FULBND
520 INTEGER I, IDIST, IGRADE, IISUB, IPACK, IPVTNG, IRSIGN,
521 $ ISUB, ISYM, J, JJSUB, JSUB, K, KLL, KUU, MNMIN,
522 $ mnsub, mxsub, npvts
523 DOUBLE PRECISION ONORM, TEMP
524 COMPLEX*16 CALPHA, CTEMP
527 DOUBLE PRECISION TEMPA( 1 )
531 DOUBLE PRECISION ZLANGB, ZLANGE, ZLANSB,
533 COMPLEX*16 ZLATM2, ZLATM3
534 EXTERNAL lsame, zlangb, zlange,
535 $ zlansb, zlansp, zlansy,
542 INTRINSIC abs, dble, dconjg, max, min, mod
553 IF( m.EQ.0 .OR. n.EQ.0 )
558 IF( lsame( dist,
'U' ) )
THEN
560 ELSE IF( lsame( dist,
'S' ) )
THEN
562 ELSE IF( lsame( dist,
'N' ) )
THEN
564 ELSE IF( lsame( dist,
'D' ) )
THEN
572 IF( lsame( sym,
'H' ) )
THEN
574 ELSE IF( lsame( sym,
'N' ) )
THEN
576 ELSE IF( lsame( sym,
'S' ) )
THEN
584 IF( lsame( rsign,
'F' ) )
THEN
586 ELSE IF( lsame( rsign,
'T' ) )
THEN
594 IF( lsame( pivtng,
'N' ) )
THEN
596 ELSE IF( lsame( pivtng,
' ' ) )
THEN
598 ELSE IF( lsame( pivtng,
'L' ) )
THEN
601 ELSE IF( lsame( pivtng,
'R' ) )
THEN
604 ELSE IF( lsame( pivtng,
'B' ) )
THEN
607 ELSE IF( lsame( pivtng,
'F' ) )
THEN
616 IF( lsame( grade,
'N' ) )
THEN
618 ELSE IF( lsame( grade,
'L' ) )
THEN
620 ELSE IF( lsame( grade,
'R' ) )
THEN
622 ELSE IF( lsame( grade,
'B' ) )
THEN
624 ELSE IF( lsame( grade,
'E' ) )
THEN
626 ELSE IF( lsame( grade,
'H' ) )
THEN
628 ELSE IF( lsame( grade,
'S' ) )
THEN
636 IF( lsame( pack,
'N' ) )
THEN
638 ELSE IF( lsame( pack,
'U' ) )
THEN
640 ELSE IF( lsame( pack,
'L' ) )
THEN
642 ELSE IF( lsame( pack,
'C' ) )
THEN
644 ELSE IF( lsame( pack,
'R' ) )
THEN
646 ELSE IF( lsame( pack,
'B' ) )
THEN
648 ELSE IF( lsame( pack,
'Q' ) )
THEN
650 ELSE IF( lsame( pack,
'Z' ) )
THEN
665 IF( igrade.EQ.4 .AND. model.EQ.0 )
THEN
667 IF( dl( i ).EQ.czero )
675 IF( ipvtng.GT.0 )
THEN
677 IF( ipivot( j ).LE.0 .OR. ipivot( j ).GT.npvts )
686 ELSE IF( m.NE.n .AND. ( isym.EQ.0 .OR. isym.EQ.2 ) )
THEN
688 ELSE IF( n.LT.0 )
THEN
690 ELSE IF( idist.EQ.-1 )
THEN
692 ELSE IF( isym.EQ.-1 )
THEN
694 ELSE IF( mode.LT.-6 .OR. mode.GT.6 )
THEN
696 ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
699 ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
700 $ irsign.EQ.-1 )
THEN
702 ELSE IF( igrade.EQ.-1 .OR. ( igrade.EQ.4 .AND. m.NE.n ) .OR.
703 $ ( ( igrade.EQ.1 .OR. igrade.EQ.2 .OR. igrade.EQ.3 .OR.
704 $ igrade.EQ.4 .OR. igrade.EQ.6 ) .AND. isym.EQ.0 ) .OR.
705 $ ( ( igrade.EQ.1 .OR. igrade.EQ.2 .OR. igrade.EQ.3 .OR.
706 $ igrade.EQ.4 .OR. igrade.EQ.5 ) .AND. isym.EQ.2 ) )
THEN
708 ELSE IF( igrade.EQ.4 .AND. dzero )
THEN
710 ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
711 $ igrade.EQ.5 .OR. igrade.EQ.6 ) .AND.
712 $ ( model.LT.-6 .OR. model.GT.6 ) )
THEN
714 ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
715 $ igrade.EQ.5 .OR. igrade.EQ.6 ) .AND.
716 $ ( model.NE.-6 .AND. model.NE.0 .AND. model.NE.6 ) .AND.
717 $ condl.LT.one )
THEN
719 ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
720 $ ( moder.LT.-6 .OR. moder.GT.6 ) )
THEN
722 ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
723 $ ( moder.NE.-6 .AND. moder.NE.0 .AND. moder.NE.6 ) .AND.
724 $ condr.LT.one )
THEN
726 ELSE IF( ipvtng.EQ.-1 .OR. ( ipvtng.EQ.3 .AND. m.NE.n ) .OR.
727 $ ( ( ipvtng.EQ.1 .OR. ipvtng.EQ.2 ) .AND. ( isym.EQ.0 .OR.
728 $ isym.EQ.2 ) ) )
THEN
730 ELSE IF( ipvtng.NE.0 .AND. badpvt )
THEN
732 ELSE IF( kl.LT.0 )
THEN
734 ELSE IF( ku.LT.0 .OR. ( ( isym.EQ.0 .OR. isym.EQ.2 ) .AND. kl.NE.
737 ELSE IF( sparse.LT.zero .OR. sparse.GT.one )
THEN
739 ELSE IF( ipack.EQ.-1 .OR. ( ( ipack.EQ.1 .OR. ipack.EQ.2 .OR.
740 $ ipack.EQ.5 .OR. ipack.EQ.6 ) .AND. isym.EQ.1 ) .OR.
741 $ ( ipack.EQ.3 .AND. isym.EQ.1 .AND. ( kl.NE.0 .OR. m.NE.
742 $ n ) ) .OR. ( ipack.EQ.4 .AND. isym.EQ.1 .AND. ( ku.NE.
743 $ 0 .OR. m.NE.n ) ) )
THEN
745 ELSE IF( ( ( ipack.EQ.0 .OR. ipack.EQ.1 .OR. ipack.EQ.2 ) .AND.
746 $ lda.LT.max( 1, m ) ) .OR. ( ( ipack.EQ.3 .OR. ipack.EQ.
747 $ 4 ) .AND. lda.LT.1 ) .OR. ( ( ipack.EQ.5 .OR. ipack.EQ.
748 $ 6 ) .AND. lda.LT.kuu+1 ) .OR.
749 $ ( ipack.EQ.7 .AND. lda.LT.kll+kuu+1 ) )
THEN
754 CALL xerbla(
'ZLATMR', -info )
761 IF( kuu.EQ.n-1 .AND. kll.EQ.m-1 )
767 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
770 iseed( 4 ) = 2*( iseed( 4 ) / 2 ) + 1
776 CALL zlatm1( mode, cond, irsign, idist, iseed, d, mnmin, info )
781 IF( mode.NE.0 .AND. mode.NE.-6 .AND. mode.NE.6 )
THEN
787 temp = max( temp, abs( d( i ) ) )
789 IF( temp.EQ.zero .AND. dmax.NE.czero )
THEN
793 IF( temp.NE.zero )
THEN
799 d( i ) = calpha*d( i )
808 d( i ) = dble( d( i ) )
814 IF( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR. igrade.EQ.
815 $ 5 .OR. igrade.EQ.6 )
THEN
816 CALL zlatm1( model, condl, 0, idist, iseed, dl, m, info )
825 IF( igrade.EQ.2 .OR. igrade.EQ.3 )
THEN
826 CALL zlatm1( moder, condr, 0, idist, iseed, dr, n, info )
835 IF( ipvtng.GT.0 )
THEN
843 iwork( i ) = iwork( k )
847 DO 90 i = npvts, 1, -1
850 iwork( i ) = iwork( k )
866 IF( ipack.EQ.0 )
THEN
870 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
871 $ idist, iseed, d, igrade, dl, dr, ipvtng,
873 a( isub, jsub ) = ctemp
874 a( jsub, isub ) = dconjg( ctemp )
877 ELSE IF( isym.EQ.1 )
THEN
880 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
881 $ idist, iseed, d, igrade, dl, dr, ipvtng,
883 a( isub, jsub ) = ctemp
886 ELSE IF( isym.EQ.2 )
THEN
889 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
890 $ idist, iseed, d, igrade, dl, dr, ipvtng,
892 a( isub, jsub ) = ctemp
893 a( jsub, isub ) = ctemp
898 ELSE IF( ipack.EQ.1 )
THEN
902 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
904 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
906 mnsub = min( isub, jsub )
907 mxsub = max( isub, jsub )
908 IF( mxsub.EQ.isub .AND. isym.EQ.0 )
THEN
909 a( mnsub, mxsub ) = dconjg( ctemp )
911 a( mnsub, mxsub ) = ctemp
914 $ a( mxsub, mnsub ) = czero
918 ELSE IF( ipack.EQ.2 )
THEN
922 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
924 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
926 mnsub = min( isub, jsub )
927 mxsub = max( isub, jsub )
928 IF( mxsub.EQ.jsub .AND. isym.EQ.0 )
THEN
929 a( mxsub, mnsub ) = dconjg( ctemp )
931 a( mxsub, mnsub ) = ctemp
934 $ a( mnsub, mxsub ) = czero
938 ELSE IF( ipack.EQ.3 )
THEN
942 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
944 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
950 mnsub = min( isub, jsub )
951 mxsub = max( isub, jsub )
952 k = mxsub*( mxsub-1 ) / 2 + mnsub
956 jjsub = ( k-1 ) / lda + 1
957 iisub = k - lda*( jjsub-1 )
959 IF( mxsub.EQ.isub .AND. isym.EQ.0 )
THEN
960 a( iisub, jjsub ) = dconjg( ctemp )
962 a( iisub, jjsub ) = ctemp
967 ELSE IF( ipack.EQ.4 )
THEN
971 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
973 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
978 mnsub = min( isub, jsub )
979 mxsub = max( isub, jsub )
980 IF( mnsub.EQ.1 )
THEN
983 k = n*( n+1 ) / 2 - ( n-mnsub+1 )*( n-mnsub+2 ) /
984 $ 2 + mxsub - mnsub + 1
989 jjsub = ( k-1 ) / lda + 1
990 iisub = k - lda*( jjsub-1 )
992 IF( mxsub.EQ.jsub .AND. isym.EQ.0 )
THEN
993 a( iisub, jjsub ) = dconjg( ctemp )
995 a( iisub, jjsub ) = ctemp
1000 ELSE IF( ipack.EQ.5 )
THEN
1003 DO 240 i = j - kuu, j
1005 a( j-i+1, i+n ) = czero
1007 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
1008 $ idist, iseed, d, igrade, dl, dr, ipvtng,
1010 mnsub = min( isub, jsub )
1011 mxsub = max( isub, jsub )
1012 IF( mxsub.EQ.jsub .AND. isym.EQ.0 )
THEN
1013 a( mxsub-mnsub+1, mnsub ) = dconjg( ctemp )
1015 a( mxsub-mnsub+1, mnsub ) = ctemp
1021 ELSE IF( ipack.EQ.6 )
THEN
1024 DO 260 i = j - kuu, j
1025 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
1027 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
1029 mnsub = min( isub, jsub )
1030 mxsub = max( isub, jsub )
1031 IF( mxsub.EQ.isub .AND. isym.EQ.0 )
THEN
1032 a( mnsub-mxsub+kuu+1, mxsub ) = dconjg( ctemp )
1034 a( mnsub-mxsub+kuu+1, mxsub ) = ctemp
1039 ELSE IF( ipack.EQ.7 )
THEN
1041 IF( isym.NE.1 )
THEN
1043 DO 280 i = j - kuu, j
1044 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
1045 $ idist, iseed, d, igrade, dl, dr, ipvtng,
1047 mnsub = min( isub, jsub )
1048 mxsub = max( isub, jsub )
1050 $ a( j-i+1+kuu, i+n ) = czero
1051 IF( mxsub.EQ.isub .AND. isym.EQ.0 )
THEN
1052 a( mnsub-mxsub+kuu+1, mxsub ) = dconjg( ctemp )
1054 a( mnsub-mxsub+kuu+1, mxsub ) = ctemp
1056 IF( i.GE.1 .AND. mnsub.NE.mxsub )
THEN
1057 IF( mnsub.EQ.isub .AND. isym.EQ.0 )
THEN
1058 a( mxsub-mnsub+1+kuu,
1059 $ mnsub ) = dconjg( ctemp )
1061 a( mxsub-mnsub+1+kuu, mnsub ) = ctemp
1066 ELSE IF( isym.EQ.1 )
THEN
1068 DO 300 i = j - kuu, j + kll
1069 ctemp = zlatm3( m, n, i, j, isub, jsub, kl, ku,
1070 $ idist, iseed, d, igrade, dl, dr, ipvtng,
1072 a( isub-jsub+kuu+1, jsub ) = ctemp
1083 IF( ipack.EQ.0 )
THEN
1084 IF( isym.EQ.0 )
THEN
1087 a( i, j ) = zlatm2( m, n, i, j, kl, ku, idist,
1088 $ iseed, d, igrade, dl, dr, ipvtng,
1090 a( j, i ) = dconjg( a( i, j ) )
1093 ELSE IF( isym.EQ.1 )
THEN
1096 a( i, j ) = zlatm2( m, n, i, j, kl, ku, idist,
1097 $ iseed, d, igrade, dl, dr, ipvtng,
1101 ELSE IF( isym.EQ.2 )
THEN
1104 a( i, j ) = zlatm2( m, n, i, j, kl, ku, idist,
1105 $ iseed, d, igrade, dl, dr, ipvtng,
1107 a( j, i ) = a( i, j )
1112 ELSE IF( ipack.EQ.1 )
THEN
1116 a( i, j ) = zlatm2( m, n, i, j, kl, ku, idist,
1118 $ d, igrade, dl, dr, ipvtng, iwork, sparse )
1124 ELSE IF( ipack.EQ.2 )
THEN
1128 IF( isym.EQ.0 )
THEN
1129 a( j, i ) = dconjg( zlatm2( m, n, i, j, kl, ku,
1130 $ idist, iseed, d, igrade, dl, dr,
1131 $ ipvtng, iwork, sparse ) )
1133 a( j, i ) = zlatm2( m, n, i, j, kl, ku, idist,
1134 $ iseed, d, igrade, dl, dr, ipvtng,
1142 ELSE IF( ipack.EQ.3 )
THEN
1149 IF( isub.GT.lda )
THEN
1153 a( isub, jsub ) = zlatm2( m, n, i, j, kl, ku,
1155 $ iseed, d, igrade, dl, dr, ipvtng,
1160 ELSE IF( ipack.EQ.4 )
THEN
1162 IF( isym.EQ.0 .OR. isym.EQ.2 )
THEN
1171 k = n*( n+1 ) / 2 - ( n-i+1 )*( n-i+2 ) / 2 +
1177 jsub = ( k-1 ) / lda + 1
1178 isub = k - lda*( jsub-1 )
1180 a( isub, jsub ) = zlatm2( m, n, i, j, kl, ku,
1181 $ idist, iseed, d, igrade, dl, dr,
1182 $ ipvtng, iwork, sparse )
1184 $ a( isub, jsub ) = dconjg( a( isub, jsub ) )
1193 IF( isub.GT.lda )
THEN
1197 a( isub, jsub ) = zlatm2( m, n, i, j, kl, ku,
1198 $ idist, iseed, d, igrade, dl, dr,
1199 $ ipvtng, iwork, sparse )
1204 ELSE IF( ipack.EQ.5 )
THEN
1207 DO 480 i = j - kuu, j
1209 a( j-i+1, i+n ) = czero
1211 IF( isym.EQ.0 )
THEN
1212 a( j-i+1, i ) = dconjg( zlatm2( m, n, i, j,
1214 $ ku, idist, iseed, d, igrade, dl,
1215 $ dr, ipvtng, iwork, sparse ) )
1217 a( j-i+1, i ) = zlatm2( m, n, i, j, kl, ku,
1218 $ idist, iseed, d, igrade, dl, dr,
1219 $ ipvtng, iwork, sparse )
1225 ELSE IF( ipack.EQ.6 )
THEN
1228 DO 500 i = j - kuu, j
1229 a( i-j+kuu+1, j ) = zlatm2( m, n, i, j, kl, ku,
1231 $ iseed, d, igrade, dl, dr, ipvtng,
1236 ELSE IF( ipack.EQ.7 )
THEN
1238 IF( isym.NE.1 )
THEN
1240 DO 520 i = j - kuu, j
1241 a( i-j+kuu+1, j ) = zlatm2( m, n, i, j, kl, ku,
1242 $ idist, iseed, d, igrade, dl,
1243 $ dr, ipvtng, iwork, sparse )
1245 $ a( j-i+1+kuu, i+n ) = czero
1246 IF( i.GE.1 .AND. i.NE.j )
THEN
1247 IF( isym.EQ.0 )
THEN
1248 a( j-i+1+kuu, i ) = dconjg( a( i-j+kuu+1,
1251 a( j-i+1+kuu, i ) = a( i-j+kuu+1, j )
1256 ELSE IF( isym.EQ.1 )
THEN
1258 DO 540 i = j - kuu, j + kll
1259 a( i-j+kuu+1, j ) = zlatm2( m, n, i, j, kl, ku,
1260 $ idist, iseed, d, igrade, dl,
1261 $ dr, ipvtng, iwork, sparse )
1272 IF( ipack.EQ.0 )
THEN
1273 onorm = zlange(
'M', m, n, a, lda, tempa )
1274 ELSE IF( ipack.EQ.1 )
THEN
1275 onorm = zlansy(
'M',
'U', n, a, lda, tempa )
1276 ELSE IF( ipack.EQ.2 )
THEN
1277 onorm = zlansy(
'M',
'L', n, a, lda, tempa )
1278 ELSE IF( ipack.EQ.3 )
THEN
1279 onorm = zlansp(
'M',
'U', n, a, tempa )
1280 ELSE IF( ipack.EQ.4 )
THEN
1281 onorm = zlansp(
'M',
'L', n, a, tempa )
1282 ELSE IF( ipack.EQ.5 )
THEN
1283 onorm = zlansb(
'M',
'L', n, kll, a, lda, tempa )
1284 ELSE IF( ipack.EQ.6 )
THEN
1285 onorm = zlansb(
'M',
'U', n, kuu, a, lda, tempa )
1286 ELSE IF( ipack.EQ.7 )
THEN
1287 onorm = zlangb(
'M', n, kll, kuu, a, lda, tempa )
1290 IF( anorm.GE.zero )
THEN
1292 IF( anorm.GT.zero .AND. onorm.EQ.zero )
THEN
1299 ELSE IF( ( anorm.GT.one .AND. onorm.LT.one ) .OR.
1300 $ ( anorm.LT.one .AND. onorm.GT.one ) )
THEN
1304 IF( ipack.LE.2 )
THEN
1306 CALL zdscal( m, one / onorm, a( 1, j ), 1 )
1307 CALL zdscal( m, anorm, a( 1, j ), 1 )
1310 ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1312 CALL zdscal( n*( n+1 ) / 2, one / onorm, a, 1 )
1313 CALL zdscal( n*( n+1 ) / 2, anorm, a, 1 )
1315 ELSE IF( ipack.GE.5 )
THEN
1318 CALL zdscal( kll+kuu+1, one / onorm, a( 1, j ), 1 )
1319 CALL zdscal( kll+kuu+1, anorm, a( 1, j ), 1 )
1328 IF( ipack.LE.2 )
THEN
1330 CALL zdscal( m, anorm / onorm, a( 1, j ), 1 )
1333 ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1335 CALL zdscal( n*( n+1 ) / 2, anorm / onorm, a, 1 )
1337 ELSE IF( ipack.GE.5 )
THEN
1340 CALL zdscal( kll+kuu+1, anorm / onorm, a( 1, j ), 1 )