467 SUBROUTINE slatmr( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
468 $ RSIGN, GRADE, DL, MODEL, CONDL, DR, MODER,
469 $ CONDR, PIVTNG, IPIVOT, KL, KU, SPARSE, ANORM,
470 $ PACK, A, LDA, IWORK, INFO )
477 CHARACTER DIST, GRADE, PACK, PIVTNG, RSIGN, SYM
478 INTEGER INFO, KL, KU, LDA, M, MODE, MODEL, MODER, N
479 REAL ANORM, COND, CONDL, CONDR, DMAX, SPARSE
482 INTEGER IPIVOT( * ), ISEED( 4 ), IWORK( * )
483 REAL A( LDA, * ), D( * ), DL( * ), DR( * )
490 PARAMETER ( ZERO = 0.0e0 )
492 parameter( one = 1.0e0 )
495 LOGICAL BADPVT, DZERO, FULBND
496 INTEGER I, IDIST, IGRADE, IISUB, IPACK, IPVTNG, IRSIGN,
497 $ ISUB, ISYM, J, JJSUB, JSUB, K, KLL, KUU, MNMIN,
498 $ mnsub, mxsub, npvts
499 REAL ALPHA, ONORM, TEMP
506 REAL SLANGB, SLANGE, SLANSB,
507 $ SLANSP, SLANSY, SLATM2,
509 EXTERNAL lsame, slangb, slange,
510 $ slansb, slansp, slansy,
517 INTRINSIC abs, max, min, mod
528 IF( m.EQ.0 .OR. n.EQ.0 )
533 IF( lsame( dist,
'U' ) )
THEN
535 ELSE IF( lsame( dist,
'S' ) )
THEN
537 ELSE IF( lsame( dist,
'N' ) )
THEN
545 IF( lsame( sym,
'S' ) )
THEN
547 ELSE IF( lsame( sym,
'N' ) )
THEN
549 ELSE IF( lsame( sym,
'H' ) )
THEN
557 IF( lsame( rsign,
'F' ) )
THEN
559 ELSE IF( lsame( rsign,
'T' ) )
THEN
567 IF( lsame( pivtng,
'N' ) )
THEN
569 ELSE IF( lsame( pivtng,
' ' ) )
THEN
571 ELSE IF( lsame( pivtng,
'L' ) )
THEN
574 ELSE IF( lsame( pivtng,
'R' ) )
THEN
577 ELSE IF( lsame( pivtng,
'B' ) )
THEN
580 ELSE IF( lsame( pivtng,
'F' ) )
THEN
589 IF( lsame( grade,
'N' ) )
THEN
591 ELSE IF( lsame( grade,
'L' ) )
THEN
593 ELSE IF( lsame( grade,
'R' ) )
THEN
595 ELSE IF( lsame( grade,
'B' ) )
THEN
597 ELSE IF( lsame( grade,
'E' ) )
THEN
599 ELSE IF( lsame( grade,
'H' ) .OR. lsame( grade,
'S' ) )
THEN
607 IF( lsame( pack,
'N' ) )
THEN
609 ELSE IF( lsame( pack,
'U' ) )
THEN
611 ELSE IF( lsame( pack,
'L' ) )
THEN
613 ELSE IF( lsame( pack,
'C' ) )
THEN
615 ELSE IF( lsame( pack,
'R' ) )
THEN
617 ELSE IF( lsame( pack,
'B' ) )
THEN
619 ELSE IF( lsame( pack,
'Q' ) )
THEN
621 ELSE IF( lsame( pack,
'Z' ) )
THEN
636 IF( igrade.EQ.4 .AND. model.EQ.0 )
THEN
638 IF( dl( i ).EQ.zero )
646 IF( ipvtng.GT.0 )
THEN
648 IF( ipivot( j ).LE.0 .OR. ipivot( j ).GT.npvts )
657 ELSE IF( m.NE.n .AND. isym.EQ.0 )
THEN
659 ELSE IF( n.LT.0 )
THEN
661 ELSE IF( idist.EQ.-1 )
THEN
663 ELSE IF( isym.EQ.-1 )
THEN
665 ELSE IF( mode.LT.-6 .OR. mode.GT.6 )
THEN
667 ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
670 ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
671 $ irsign.EQ.-1 )
THEN
673 ELSE IF( igrade.EQ.-1 .OR. ( igrade.EQ.4 .AND. m.NE.n ) .OR.
674 $ ( ( igrade.GE.1 .AND. igrade.LE.4 ) .AND. isym.EQ.0 ) )
677 ELSE IF( igrade.EQ.4 .AND. dzero )
THEN
679 ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
680 $ igrade.EQ.5 ) .AND. ( model.LT.-6 .OR. model.GT.6 ) )
683 ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
684 $ igrade.EQ.5 ) .AND. ( model.NE.-6 .AND. model.NE.0 .AND.
685 $ model.NE.6 ) .AND. condl.LT.one )
THEN
687 ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
688 $ ( moder.LT.-6 .OR. moder.GT.6 ) )
THEN
690 ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
691 $ ( moder.NE.-6 .AND. moder.NE.0 .AND. moder.NE.6 ) .AND.
692 $ condr.LT.one )
THEN
694 ELSE IF( ipvtng.EQ.-1 .OR. ( ipvtng.EQ.3 .AND. m.NE.n ) .OR.
695 $ ( ( ipvtng.EQ.1 .OR. ipvtng.EQ.2 ) .AND. isym.EQ.0 ) )
698 ELSE IF( ipvtng.NE.0 .AND. badpvt )
THEN
700 ELSE IF( kl.LT.0 )
THEN
702 ELSE IF( ku.LT.0 .OR. ( isym.EQ.0 .AND. kl.NE.ku ) )
THEN
704 ELSE IF( sparse.LT.zero .OR. sparse.GT.one )
THEN
706 ELSE IF( ipack.EQ.-1 .OR. ( ( ipack.EQ.1 .OR. ipack.EQ.2 .OR.
707 $ ipack.EQ.5 .OR. ipack.EQ.6 ) .AND. isym.EQ.1 ) .OR.
708 $ ( ipack.EQ.3 .AND. isym.EQ.1 .AND. ( kl.NE.0 .OR. m.NE.
709 $ n ) ) .OR. ( ipack.EQ.4 .AND. isym.EQ.1 .AND. ( ku.NE.
710 $ 0 .OR. m.NE.n ) ) )
THEN
712 ELSE IF( ( ( ipack.EQ.0 .OR. ipack.EQ.1 .OR. ipack.EQ.2 ) .AND.
713 $ lda.LT.max( 1, m ) ) .OR. ( ( ipack.EQ.3 .OR. ipack.EQ.
714 $ 4 ) .AND. lda.LT.1 ) .OR. ( ( ipack.EQ.5 .OR. ipack.EQ.
715 $ 6 ) .AND. lda.LT.kuu+1 ) .OR.
716 $ ( ipack.EQ.7 .AND. lda.LT.kll+kuu+1 ) )
THEN
721 CALL xerbla(
'SLATMR', -info )
728 IF( kuu.EQ.n-1 .AND. kll.EQ.m-1 )
734 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
737 iseed( 4 ) = 2*( iseed( 4 ) / 2 ) + 1
743 CALL slatm1( mode, cond, irsign, idist, iseed, d, mnmin, info )
748 IF( mode.NE.0 .AND. mode.NE.-6 .AND. mode.NE.6 )
THEN
754 temp = max( temp, abs( d( i ) ) )
756 IF( temp.EQ.zero .AND. dmax.NE.zero )
THEN
760 IF( temp.NE.zero )
THEN
766 d( i ) = alpha*d( i )
773 IF( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR. igrade.EQ.
775 CALL slatm1( model, condl, 0, idist, iseed, dl, m, info )
784 IF( igrade.EQ.2 .OR. igrade.EQ.3 )
THEN
785 CALL slatm1( moder, condr, 0, idist, iseed, dr, n, info )
794 IF( ipvtng.GT.0 )
THEN
802 iwork( i ) = iwork( k )
806 DO 80 i = npvts, 1, -1
809 iwork( i ) = iwork( k )
825 IF( ipack.EQ.0 )
THEN
829 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
830 $ idist, iseed, d, igrade, dl, dr, ipvtng,
832 a( isub, jsub ) = temp
833 a( jsub, isub ) = temp
836 ELSE IF( isym.EQ.1 )
THEN
839 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
840 $ idist, iseed, d, igrade, dl, dr, ipvtng,
842 a( isub, jsub ) = temp
847 ELSE IF( ipack.EQ.1 )
THEN
851 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
853 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
855 mnsub = min( isub, jsub )
856 mxsub = max( isub, jsub )
857 a( mnsub, mxsub ) = temp
859 $ a( mxsub, mnsub ) = zero
863 ELSE IF( ipack.EQ.2 )
THEN
867 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
869 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
871 mnsub = min( isub, jsub )
872 mxsub = max( isub, jsub )
873 a( mxsub, mnsub ) = temp
875 $ a( mnsub, mxsub ) = zero
879 ELSE IF( ipack.EQ.3 )
THEN
883 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
885 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
891 mnsub = min( isub, jsub )
892 mxsub = max( isub, jsub )
893 k = mxsub*( mxsub-1 ) / 2 + mnsub
897 jjsub = ( k-1 ) / lda + 1
898 iisub = k - lda*( jjsub-1 )
900 a( iisub, jjsub ) = temp
904 ELSE IF( ipack.EQ.4 )
THEN
908 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
910 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
915 mnsub = min( isub, jsub )
916 mxsub = max( isub, jsub )
917 IF( mnsub.EQ.1 )
THEN
920 k = n*( n+1 ) / 2 - ( n-mnsub+1 )*( n-mnsub+2 ) /
921 $ 2 + mxsub - mnsub + 1
926 jjsub = ( k-1 ) / lda + 1
927 iisub = k - lda*( jjsub-1 )
929 a( iisub, jjsub ) = temp
933 ELSE IF( ipack.EQ.5 )
THEN
936 DO 210 i = j - kuu, j
938 a( j-i+1, i+n ) = zero
940 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
941 $ idist, iseed, d, igrade, dl, dr, ipvtng,
943 mnsub = min( isub, jsub )
944 mxsub = max( isub, jsub )
945 a( mxsub-mnsub+1, mnsub ) = temp
950 ELSE IF( ipack.EQ.6 )
THEN
953 DO 230 i = j - kuu, j
954 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
956 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
958 mnsub = min( isub, jsub )
959 mxsub = max( isub, jsub )
960 a( mnsub-mxsub+kuu+1, mxsub ) = temp
964 ELSE IF( ipack.EQ.7 )
THEN
968 DO 250 i = j - kuu, j
969 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
970 $ idist, iseed, d, igrade, dl, dr, ipvtng,
972 mnsub = min( isub, jsub )
973 mxsub = max( isub, jsub )
974 a( mnsub-mxsub+kuu+1, mxsub ) = temp
976 $ a( j-i+1+kuu, i+n ) = zero
977 IF( i.GE.1 .AND. mnsub.NE.mxsub )
978 $ a( mxsub-mnsub+1+kuu, mnsub ) = temp
981 ELSE IF( isym.EQ.1 )
THEN
983 DO 270 i = j - kuu, j + kll
984 temp =
slatm3( m, n, i, j, isub, jsub, kl, ku,
985 $ idist, iseed, d, igrade, dl, dr, ipvtng,
987 a( isub-jsub+kuu+1, jsub ) = temp
998 IF( ipack.EQ.0 )
THEN
1002 a( i, j ) = slatm2( m, n, i, j, kl, ku, idist,
1003 $ iseed, d, igrade, dl, dr, ipvtng,
1005 a( j, i ) = a( i, j )
1008 ELSE IF( isym.EQ.1 )
THEN
1011 a( i, j ) = slatm2( m, n, i, j, kl, ku, idist,
1012 $ iseed, d, igrade, dl, dr, ipvtng,
1018 ELSE IF( ipack.EQ.1 )
THEN
1022 a( i, j ) = slatm2( m, n, i, j, kl, ku, idist,
1024 $ d, igrade, dl, dr, ipvtng, iwork, sparse )
1030 ELSE IF( ipack.EQ.2 )
THEN
1034 a( j, i ) = slatm2( m, n, i, j, kl, ku, idist,
1036 $ d, igrade, dl, dr, ipvtng, iwork, sparse )
1042 ELSE IF( ipack.EQ.3 )
THEN
1049 IF( isub.GT.lda )
THEN
1053 a( isub, jsub ) = slatm2( m, n, i, j, kl, ku,
1055 $ iseed, d, igrade, dl, dr, ipvtng,
1060 ELSE IF( ipack.EQ.4 )
THEN
1062 IF( isym.EQ.0 )
THEN
1071 k = n*( n+1 ) / 2 - ( n-i+1 )*( n-i+2 ) / 2 +
1077 jsub = ( k-1 ) / lda + 1
1078 isub = k - lda*( jsub-1 )
1080 a( isub, jsub ) = slatm2( m, n, i, j, kl, ku,
1081 $ idist, iseed, d, igrade, dl, dr,
1082 $ ipvtng, iwork, sparse )
1091 IF( isub.GT.lda )
THEN
1095 a( isub, jsub ) = slatm2( m, n, i, j, kl, ku,
1096 $ idist, iseed, d, igrade, dl, dr,
1097 $ ipvtng, iwork, sparse )
1102 ELSE IF( ipack.EQ.5 )
THEN
1105 DO 430 i = j - kuu, j
1107 a( j-i+1, i+n ) = zero
1109 a( j-i+1, i ) = slatm2( m, n, i, j, kl, ku,
1111 $ iseed, d, igrade, dl, dr, ipvtng,
1117 ELSE IF( ipack.EQ.6 )
THEN
1120 DO 450 i = j - kuu, j
1121 a( i-j+kuu+1, j ) = slatm2( m, n, i, j, kl, ku,
1123 $ iseed, d, igrade, dl, dr, ipvtng,
1128 ELSE IF( ipack.EQ.7 )
THEN
1130 IF( isym.EQ.0 )
THEN
1132 DO 470 i = j - kuu, j
1133 a( i-j+kuu+1, j ) = slatm2( m, n, i, j, kl, ku,
1134 $ idist, iseed, d, igrade, dl,
1135 $ dr, ipvtng, iwork, sparse )
1137 $ a( j-i+1+kuu, i+n ) = zero
1138 IF( i.GE.1 .AND. i.NE.j )
1139 $ a( j-i+1+kuu, i ) = a( i-j+kuu+1, j )
1142 ELSE IF( isym.EQ.1 )
THEN
1144 DO 490 i = j - kuu, j + kll
1145 a( i-j+kuu+1, j ) = slatm2( m, n, i, j, kl, ku,
1146 $ idist, iseed, d, igrade, dl,
1147 $ dr, ipvtng, iwork, sparse )
1158 IF( ipack.EQ.0 )
THEN
1159 onorm = slange(
'M', m, n, a, lda, tempa )
1160 ELSE IF( ipack.EQ.1 )
THEN
1161 onorm = slansy(
'M',
'U', n, a, lda, tempa )
1162 ELSE IF( ipack.EQ.2 )
THEN
1163 onorm = slansy(
'M',
'L', n, a, lda, tempa )
1164 ELSE IF( ipack.EQ.3 )
THEN
1165 onorm = slansp(
'M',
'U', n, a, tempa )
1166 ELSE IF( ipack.EQ.4 )
THEN
1167 onorm = slansp(
'M',
'L', n, a, tempa )
1168 ELSE IF( ipack.EQ.5 )
THEN
1169 onorm = slansb(
'M',
'L', n, kll, a, lda, tempa )
1170 ELSE IF( ipack.EQ.6 )
THEN
1171 onorm = slansb(
'M',
'U', n, kuu, a, lda, tempa )
1172 ELSE IF( ipack.EQ.7 )
THEN
1173 onorm = slangb(
'M', n, kll, kuu, a, lda, tempa )
1176 IF( anorm.GE.zero )
THEN
1178 IF( anorm.GT.zero .AND. onorm.EQ.zero )
THEN
1185 ELSE IF( ( anorm.GT.one .AND. onorm.LT.one ) .OR.
1186 $ ( anorm.LT.one .AND. onorm.GT.one ) )
THEN
1190 IF( ipack.LE.2 )
THEN
1192 CALL sscal( m, one / onorm, a( 1, j ), 1 )
1193 CALL sscal( m, anorm, a( 1, j ), 1 )
1196 ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1198 CALL sscal( n*( n+1 ) / 2, one / onorm, a, 1 )
1199 CALL sscal( n*( n+1 ) / 2, anorm, a, 1 )
1201 ELSE IF( ipack.GE.5 )
THEN
1204 CALL sscal( kll+kuu+1, one / onorm, a( 1, j ), 1 )
1205 CALL sscal( kll+kuu+1, anorm, a( 1, j ), 1 )
1214 IF( ipack.LE.2 )
THEN
1216 CALL sscal( m, anorm / onorm, a( 1, j ), 1 )
1219 ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1221 CALL sscal( n*( n+1 ) / 2, anorm / onorm, a, 1 )
1223 ELSE IF( ipack.GE.5 )
THEN
1226 CALL sscal( kll+kuu+1, anorm / onorm, a( 1, j ), 1 )