467 SUBROUTINE dlatmr( 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 DOUBLE PRECISION ANORM, COND, CONDL, CONDR, DMAX, SPARSE
482 INTEGER IPIVOT( * ), ISEED( 4 ), IWORK( * )
483 DOUBLE PRECISION A( LDA, * ), D( * ), DL( * ), DR( * )
489 DOUBLE PRECISION ZERO
490 PARAMETER ( ZERO = 0.0d0 )
492 parameter( one = 1.0d0 )
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 DOUBLE PRECISION ALPHA, ONORM, TEMP
502 DOUBLE PRECISION TEMPA( 1 )
506 DOUBLE PRECISION DLANGB, DLANGE, DLANSB, DLANSP, DLANSY, DLATM2,
508 EXTERNAL lsame, dlangb, dlange, dlansb, dlansp, dlansy,
515 INTRINSIC abs, max, min, mod
526 IF( m.EQ.0 .OR. n.EQ.0 )
531 IF( lsame( dist,
'U' ) )
THEN
533 ELSE IF( lsame( dist,
'S' ) )
THEN
535 ELSE IF( lsame( dist,
'N' ) )
THEN
543 IF( lsame( sym,
'S' ) )
THEN
545 ELSE IF( lsame( sym,
'N' ) )
THEN
547 ELSE IF( lsame( sym,
'H' ) )
THEN
555 IF( lsame( rsign,
'F' ) )
THEN
557 ELSE IF( lsame( rsign,
'T' ) )
THEN
565 IF( lsame( pivtng,
'N' ) )
THEN
567 ELSE IF( lsame( pivtng,
' ' ) )
THEN
569 ELSE IF( lsame( pivtng,
'L' ) )
THEN
572 ELSE IF( lsame( pivtng,
'R' ) )
THEN
575 ELSE IF( lsame( pivtng,
'B' ) )
THEN
578 ELSE IF( lsame( pivtng,
'F' ) )
THEN
587 IF( lsame( grade,
'N' ) )
THEN
589 ELSE IF( lsame( grade,
'L' ) )
THEN
591 ELSE IF( lsame( grade,
'R' ) )
THEN
593 ELSE IF( lsame( grade,
'B' ) )
THEN
595 ELSE IF( lsame( grade,
'E' ) )
THEN
597 ELSE IF( lsame( grade,
'H' ) .OR. lsame( grade,
'S' ) )
THEN
605 IF( lsame( pack,
'N' ) )
THEN
607 ELSE IF( lsame( pack,
'U' ) )
THEN
609 ELSE IF( lsame( pack,
'L' ) )
THEN
611 ELSE IF( lsame( pack,
'C' ) )
THEN
613 ELSE IF( lsame( pack,
'R' ) )
THEN
615 ELSE IF( lsame( pack,
'B' ) )
THEN
617 ELSE IF( lsame( pack,
'Q' ) )
THEN
619 ELSE IF( lsame( pack,
'Z' ) )
THEN
634 IF( igrade.EQ.4 .AND. model.EQ.0 )
THEN
636 IF( dl( i ).EQ.zero )
644 IF( ipvtng.GT.0 )
THEN
646 IF( ipivot( j ).LE.0 .OR. ipivot( j ).GT.npvts )
655 ELSE IF( m.NE.n .AND. isym.EQ.0 )
THEN
657 ELSE IF( n.LT.0 )
THEN
659 ELSE IF( idist.EQ.-1 )
THEN
661 ELSE IF( isym.EQ.-1 )
THEN
663 ELSE IF( mode.LT.-6 .OR. mode.GT.6 )
THEN
665 ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
668 ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
669 $ irsign.EQ.-1 )
THEN
671 ELSE IF( igrade.EQ.-1 .OR. ( igrade.EQ.4 .AND. m.NE.n ) .OR.
672 $ ( ( igrade.GE.1 .AND. igrade.LE.4 ) .AND. isym.EQ.0 ) )
675 ELSE IF( igrade.EQ.4 .AND. dzero )
THEN
677 ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
678 $ igrade.EQ.5 ) .AND. ( model.LT.-6 .OR. model.GT.6 ) )
681 ELSE IF( ( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR.
682 $ igrade.EQ.5 ) .AND. ( model.NE.-6 .AND. model.NE.0 .AND.
683 $ model.NE.6 ) .AND. condl.LT.one )
THEN
685 ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
686 $ ( moder.LT.-6 .OR. moder.GT.6 ) )
THEN
688 ELSE IF( ( igrade.EQ.2 .OR. igrade.EQ.3 ) .AND.
689 $ ( moder.NE.-6 .AND. moder.NE.0 .AND. moder.NE.6 ) .AND.
690 $ condr.LT.one )
THEN
692 ELSE IF( ipvtng.EQ.-1 .OR. ( ipvtng.EQ.3 .AND. m.NE.n ) .OR.
693 $ ( ( ipvtng.EQ.1 .OR. ipvtng.EQ.2 ) .AND. isym.EQ.0 ) )
696 ELSE IF( ipvtng.NE.0 .AND. badpvt )
THEN
698 ELSE IF( kl.LT.0 )
THEN
700 ELSE IF( ku.LT.0 .OR. ( isym.EQ.0 .AND. kl.NE.ku ) )
THEN
702 ELSE IF( sparse.LT.zero .OR. sparse.GT.one )
THEN
704 ELSE IF( ipack.EQ.-1 .OR. ( ( ipack.EQ.1 .OR. ipack.EQ.2 .OR.
705 $ ipack.EQ.5 .OR. ipack.EQ.6 ) .AND. isym.EQ.1 ) .OR.
706 $ ( ipack.EQ.3 .AND. isym.EQ.1 .AND. ( kl.NE.0 .OR. m.NE.
707 $ n ) ) .OR. ( ipack.EQ.4 .AND. isym.EQ.1 .AND. ( ku.NE.
708 $ 0 .OR. m.NE.n ) ) )
THEN
710 ELSE IF( ( ( ipack.EQ.0 .OR. ipack.EQ.1 .OR. ipack.EQ.2 ) .AND.
711 $ lda.LT.max( 1, m ) ) .OR. ( ( ipack.EQ.3 .OR. ipack.EQ.
712 $ 4 ) .AND. lda.LT.1 ) .OR. ( ( ipack.EQ.5 .OR. ipack.EQ.
713 $ 6 ) .AND. lda.LT.kuu+1 ) .OR.
714 $ ( ipack.EQ.7 .AND. lda.LT.kll+kuu+1 ) )
THEN
719 CALL xerbla(
'DLATMR', -info )
726 IF( kuu.EQ.n-1 .AND. kll.EQ.m-1 )
732 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
735 iseed( 4 ) = 2*( iseed( 4 ) / 2 ) + 1
741 CALL dlatm1( mode, cond, irsign, idist, iseed, d, mnmin, info )
746 IF( mode.NE.0 .AND. mode.NE.-6 .AND. mode.NE.6 )
THEN
752 temp = max( temp, abs( d( i ) ) )
754 IF( temp.EQ.zero .AND. dmax.NE.zero )
THEN
758 IF( temp.NE.zero )
THEN
764 d( i ) = alpha*d( i )
771 IF( igrade.EQ.1 .OR. igrade.EQ.3 .OR. igrade.EQ.4 .OR. igrade.EQ.
773 CALL dlatm1( model, condl, 0, idist, iseed, dl, m, info )
782 IF( igrade.EQ.2 .OR. igrade.EQ.3 )
THEN
783 CALL dlatm1( moder, condr, 0, idist, iseed, dr, n, info )
792 IF( ipvtng.GT.0 )
THEN
800 iwork( i ) = iwork( k )
804 DO 80 i = npvts, 1, -1
807 iwork( i ) = iwork( k )
823 IF( ipack.EQ.0 )
THEN
827 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku,
828 $ idist, iseed, d, igrade, dl, dr, ipvtng,
830 a( isub, jsub ) = temp
831 a( jsub, isub ) = temp
834 ELSE IF( isym.EQ.1 )
THEN
837 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku,
838 $ idist, iseed, d, igrade, dl, dr, ipvtng,
840 a( isub, jsub ) = temp
845 ELSE IF( ipack.EQ.1 )
THEN
849 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku, idist,
850 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
852 mnsub = min( isub, jsub )
853 mxsub = max( isub, jsub )
854 a( mnsub, mxsub ) = temp
856 $ a( mxsub, mnsub ) = zero
860 ELSE IF( ipack.EQ.2 )
THEN
864 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku, idist,
865 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
867 mnsub = min( isub, jsub )
868 mxsub = max( isub, jsub )
869 a( mxsub, mnsub ) = temp
871 $ a( mnsub, mxsub ) = zero
875 ELSE IF( ipack.EQ.3 )
THEN
879 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku, idist,
880 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
886 mnsub = min( isub, jsub )
887 mxsub = max( isub, jsub )
888 k = mxsub*( mxsub-1 ) / 2 + mnsub
892 jjsub = ( k-1 ) / lda + 1
893 iisub = k - lda*( jjsub-1 )
895 a( iisub, jjsub ) = temp
899 ELSE IF( ipack.EQ.4 )
THEN
903 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku, idist,
904 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
909 mnsub = min( isub, jsub )
910 mxsub = max( isub, jsub )
911 IF( mnsub.EQ.1 )
THEN
914 k = n*( n+1 ) / 2 - ( n-mnsub+1 )*( n-mnsub+2 ) /
915 $ 2 + mxsub - mnsub + 1
920 jjsub = ( k-1 ) / lda + 1
921 iisub = k - lda*( jjsub-1 )
923 a( iisub, jjsub ) = temp
927 ELSE IF( ipack.EQ.5 )
THEN
930 DO 210 i = j - kuu, j
932 a( j-i+1, i+n ) = zero
934 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku,
935 $ idist, iseed, d, igrade, dl, dr, ipvtng,
937 mnsub = min( isub, jsub )
938 mxsub = max( isub, jsub )
939 a( mxsub-mnsub+1, mnsub ) = temp
944 ELSE IF( ipack.EQ.6 )
THEN
947 DO 230 i = j - kuu, j
948 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku, idist,
949 $ iseed, d, igrade, dl, dr, ipvtng, iwork,
951 mnsub = min( isub, jsub )
952 mxsub = max( isub, jsub )
953 a( mnsub-mxsub+kuu+1, mxsub ) = temp
957 ELSE IF( ipack.EQ.7 )
THEN
961 DO 250 i = j - kuu, j
962 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku,
963 $ idist, iseed, d, igrade, dl, dr, ipvtng,
965 mnsub = min( isub, jsub )
966 mxsub = max( isub, jsub )
967 a( mnsub-mxsub+kuu+1, mxsub ) = temp
969 $ a( j-i+1+kuu, i+n ) = zero
970 IF( i.GE.1 .AND. mnsub.NE.mxsub )
971 $ a( mxsub-mnsub+1+kuu, mnsub ) = temp
974 ELSE IF( isym.EQ.1 )
THEN
976 DO 270 i = j - kuu, j + kll
977 temp = dlatm3( m, n, i, j, isub, jsub, kl, ku,
978 $ idist, iseed, d, igrade, dl, dr, ipvtng,
980 a( isub-jsub+kuu+1, jsub ) = temp
991 IF( ipack.EQ.0 )
THEN
995 a( i, j ) = dlatm2( m, n, i, j, kl, ku, idist,
996 $ iseed, d, igrade, dl, dr, ipvtng,
998 a( j, i ) = a( i, j )
1001 ELSE IF( isym.EQ.1 )
THEN
1004 a( i, j ) = dlatm2( m, n, i, j, kl, ku, idist,
1005 $ iseed, d, igrade, dl, dr, ipvtng,
1011 ELSE IF( ipack.EQ.1 )
THEN
1015 a( i, j ) = dlatm2( m, n, i, j, kl, ku, idist, iseed,
1016 $ d, igrade, dl, dr, ipvtng, iwork, sparse )
1022 ELSE IF( ipack.EQ.2 )
THEN
1026 a( j, i ) = dlatm2( m, n, i, j, kl, ku, idist, iseed,
1027 $ d, igrade, dl, dr, ipvtng, iwork, sparse )
1033 ELSE IF( ipack.EQ.3 )
THEN
1040 IF( isub.GT.lda )
THEN
1044 a( isub, jsub ) = dlatm2( m, n, i, j, kl, ku, idist,
1045 $ iseed, d, igrade, dl, dr, ipvtng,
1050 ELSE IF( ipack.EQ.4 )
THEN
1052 IF( isym.EQ.0 )
THEN
1061 k = n*( n+1 ) / 2 - ( n-i+1 )*( n-i+2 ) / 2 +
1067 jsub = ( k-1 ) / lda + 1
1068 isub = k - lda*( jsub-1 )
1070 a( isub, jsub ) = dlatm2( m, n, i, j, kl, ku,
1071 $ idist, iseed, d, igrade, dl, dr,
1072 $ ipvtng, iwork, sparse )
1081 IF( isub.GT.lda )
THEN
1085 a( isub, jsub ) = dlatm2( m, n, i, j, kl, ku,
1086 $ idist, iseed, d, igrade, dl, dr,
1087 $ ipvtng, iwork, sparse )
1092 ELSE IF( ipack.EQ.5 )
THEN
1095 DO 430 i = j - kuu, j
1097 a( j-i+1, i+n ) = zero
1099 a( j-i+1, i ) = dlatm2( m, n, i, j, kl, ku, idist,
1100 $ iseed, d, igrade, dl, dr, ipvtng,
1106 ELSE IF( ipack.EQ.6 )
THEN
1109 DO 450 i = j - kuu, j
1110 a( i-j+kuu+1, j ) = dlatm2( m, n, i, j, kl, ku, idist,
1111 $ iseed, d, igrade, dl, dr, ipvtng,
1116 ELSE IF( ipack.EQ.7 )
THEN
1118 IF( isym.EQ.0 )
THEN
1120 DO 470 i = j - kuu, j
1121 a( i-j+kuu+1, j ) = dlatm2( m, n, i, j, kl, ku,
1122 $ idist, iseed, d, igrade, dl,
1123 $ dr, ipvtng, iwork, sparse )
1125 $ a( j-i+1+kuu, i+n ) = zero
1126 IF( i.GE.1 .AND. i.NE.j )
1127 $ a( j-i+1+kuu, i ) = a( i-j+kuu+1, j )
1130 ELSE IF( isym.EQ.1 )
THEN
1132 DO 490 i = j - kuu, j + kll
1133 a( i-j+kuu+1, j ) = dlatm2( m, n, i, j, kl, ku,
1134 $ idist, iseed, d, igrade, dl,
1135 $ dr, ipvtng, iwork, sparse )
1146 IF( ipack.EQ.0 )
THEN
1147 onorm = dlange(
'M', m, n, a, lda, tempa )
1148 ELSE IF( ipack.EQ.1 )
THEN
1149 onorm = dlansy(
'M',
'U', n, a, lda, tempa )
1150 ELSE IF( ipack.EQ.2 )
THEN
1151 onorm = dlansy(
'M',
'L', n, a, lda, tempa )
1152 ELSE IF( ipack.EQ.3 )
THEN
1153 onorm = dlansp(
'M',
'U', n, a, tempa )
1154 ELSE IF( ipack.EQ.4 )
THEN
1155 onorm = dlansp(
'M',
'L', n, a, tempa )
1156 ELSE IF( ipack.EQ.5 )
THEN
1157 onorm = dlansb(
'M',
'L', n, kll, a, lda, tempa )
1158 ELSE IF( ipack.EQ.6 )
THEN
1159 onorm = dlansb(
'M',
'U', n, kuu, a, lda, tempa )
1160 ELSE IF( ipack.EQ.7 )
THEN
1161 onorm = dlangb(
'M', n, kll, kuu, a, lda, tempa )
1164 IF( anorm.GE.zero )
THEN
1166 IF( anorm.GT.zero .AND. onorm.EQ.zero )
THEN
1173 ELSE IF( ( anorm.GT.one .AND. onorm.LT.one ) .OR.
1174 $ ( anorm.LT.one .AND. onorm.GT.one ) )
THEN
1178 IF( ipack.LE.2 )
THEN
1180 CALL dscal( m, one / onorm, a( 1, j ), 1 )
1181 CALL dscal( m, anorm, a( 1, j ), 1 )
1184 ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1186 CALL dscal( n*( n+1 ) / 2, one / onorm, a, 1 )
1187 CALL dscal( n*( n+1 ) / 2, anorm, a, 1 )
1189 ELSE IF( ipack.GE.5 )
THEN
1192 CALL dscal( kll+kuu+1, one / onorm, a( 1, j ), 1 )
1193 CALL dscal( kll+kuu+1, anorm, a( 1, j ), 1 )
1202 IF( ipack.LE.2 )
THEN
1204 CALL dscal( m, anorm / onorm, a( 1, j ), 1 )
1207 ELSE IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1209 CALL dscal( n*( n+1 ) / 2, anorm / onorm, a, 1 )
1211 ELSE IF( ipack.GE.5 )
THEN
1214 CALL dscal( kll+kuu+1, anorm / onorm, a( 1, j ), 1 )
subroutine xerbla(srname, info)
subroutine dlatm1(mode, cond, irsign, idist, iseed, d, n, info)
DLATM1
subroutine dlatmr(m, n, dist, iseed, sym, d, mode, cond, dmax, rsign, grade, dl, model, condl, dr, moder, condr, pivtng, ipivot, kl, ku, sparse, anorm, pack, a, lda, iwork, info)
DLATMR
subroutine dscal(n, da, dx, incx)
DSCAL