330 SUBROUTINE zlatms( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
331 $ KL, KU, PACK, A, LDA, WORK, INFO )
338 CHARACTER DIST, PACK, SYM
339 INTEGER INFO, KL, KU, LDA, M, MODE, N
340 DOUBLE PRECISION COND, DMAX
344 DOUBLE PRECISION D( * )
345 COMPLEX*16 A( LDA, * ), WORK( * )
351 DOUBLE PRECISION ZERO
352 parameter( zero = 0.0d+0 )
354 parameter( one = 1.0d+0 )
356 parameter( czero = ( 0.0d+0, 0.0d+0 ) )
357 DOUBLE PRECISION TWOPI
358 parameter( twopi = 6.28318530717958647692528676655900576839d+0 )
361 LOGICAL GIVENS, ILEXTR, ILTEMP, TOPDWN, ZSYM
362 INTEGER I, IC, ICOL, IDIST, IENDCH, IINFO, IL, ILDA,
363 $ ioffg, ioffst, ipack, ipackg, ir, ir1, ir2,
364 $ irow, irsign, iskew, isym, isympk, j, jc, jch,
365 $ jkl, jku, jr, k, llb, minlda, mnmin, mr, nc,
367 DOUBLE PRECISION ALPHA, ANGLE, REALC, TEMP
368 COMPLEX*16 C, CT, CTEMP, DUMMY, EXTRA, S, ST
372 DOUBLE PRECISION DLARND
374 EXTERNAL lsame, dlarnd, zlarnd
381 INTRINSIC abs, cos, dble, dcmplx, dconjg, max, min, mod,
393 IF( m.EQ.0 .OR. n.EQ.0 )
398 IF( lsame( dist,
'U' ) )
THEN
400 ELSE IF( lsame( dist,
'S' ) )
THEN
402 ELSE IF( lsame( dist,
'N' ) )
THEN
410 IF( lsame( sym,
'N' ) )
THEN
414 ELSE IF( lsame( sym,
'P' ) )
THEN
418 ELSE IF( lsame( sym,
'S' ) )
THEN
422 ELSE IF( lsame( sym,
'H' ) )
THEN
433 IF( lsame( pack,
'N' ) )
THEN
435 ELSE IF( lsame( pack,
'U' ) )
THEN
438 ELSE IF( lsame( pack,
'L' ) )
THEN
441 ELSE IF( lsame( pack,
'C' ) )
THEN
444 ELSE IF( lsame( pack,
'R' ) )
THEN
447 ELSE IF( lsame( pack,
'B' ) )
THEN
450 ELSE IF( lsame( pack,
'Q' ) )
THEN
453 ELSE IF( lsame( pack,
'Z' ) )
THEN
467 IF( ipack.EQ.5 .OR. ipack.EQ.6 )
THEN
469 ELSE IF( ipack.EQ.7 )
THEN
470 minlda = llb + uub + 1
480 IF( dble( llb+uub ).LT.0.3d0*dble( max( 1, mr+nc ) ) )
486 IF( lda.LT.m .AND. lda.GE.minlda )
493 ELSE IF( m.NE.n .AND. isym.NE.1 )
THEN
495 ELSE IF( n.LT.0 )
THEN
497 ELSE IF( idist.EQ.-1 )
THEN
499 ELSE IF( isym.EQ.-1 )
THEN
501 ELSE IF( abs( mode ).GT.6 )
THEN
503 ELSE IF( ( mode.NE.0 .AND. abs( mode ).NE.6 ) .AND. cond.LT.one )
506 ELSE IF( kl.LT.0 )
THEN
508 ELSE IF( ku.LT.0 .OR. ( isym.NE.1 .AND. kl.NE.ku ) )
THEN
510 ELSE IF( ipack.EQ.-1 .OR. ( isympk.EQ.1 .AND. isym.EQ.1 ) .OR.
511 $ ( isympk.EQ.2 .AND. isym.EQ.1 .AND. kl.GT.0 ) .OR.
512 $ ( isympk.EQ.3 .AND. isym.EQ.1 .AND. ku.GT.0 ) .OR.
513 $ ( isympk.NE.0 .AND. m.NE.n ) )
THEN
515 ELSE IF( lda.LT.max( 1, minlda ) )
THEN
520 CALL xerbla(
'ZLATMS', -info )
527 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
530 IF( mod( iseed( 4 ), 2 ).NE.1 )
531 $ iseed( 4 ) = iseed( 4 ) + 1
537 CALL dlatm1( mode, cond, irsign, idist, iseed, d, mnmin, iinfo )
538 IF( iinfo.NE.0 )
THEN
546 IF( abs( d( 1 ) ).LE.abs( d( mnmin ) ) )
THEN
552 IF( mode.NE.0 .AND. abs( mode ).NE.6 )
THEN
558 temp = max( temp, abs( d( i ) ) )
561 IF( temp.GT.zero )
THEN
568 CALL dscal( mnmin, alpha, d, 1 )
572 CALL zlaset(
'Full', lda, n, czero, czero, a, lda )
583 IF( ipack.GT.4 )
THEN
586 IF( ipack.GT.5 )
THEN
606 IF( llb.EQ.0 .AND. uub.EQ.0 )
THEN
608 a( ( 1-iskew )*j+ioffst, j ) = dcmplx( d( j ) )
611 IF( ipack.LE.2 .OR. ipack.GE.5 )
614 ELSE IF( givens )
THEN
623 IF( ipack.GT.4 )
THEN
630 a( ( 1-iskew )*j+ioffst, j ) = dcmplx( d( j ) )
642 DO 60 jr = 1, min( m+jku, n ) + jkl - 1
644 angle = twopi*dlarnd( 1, iseed )
645 c = cos( angle )*zlarnd( 5, iseed )
646 s = sin( angle )*zlarnd( 5, iseed )
647 icol = max( 1, jr-jkl )
649 il = min( n, jr+jku ) + 1 - icol
650 CALL zlarot( .true., jr.GT.jkl, .false., il, c,
651 $ s, a( jr-iskew*icol+ioffst, icol ),
652 $ ilda, extra, dummy )
659 DO 50 jch = jr - jkl, 1, -jkl - jku
661 CALL zlartg( a( ir+1-iskew*( ic+1 )+ioffst,
662 $ ic+1 ), extra, realc, s, dummy )
663 dummy = zlarnd( 5, iseed )
664 c = dconjg( realc*dummy )
665 s = dconjg( -s*dummy )
667 irow = max( 1, jch-jku )
671 CALL zlarot( .false., iltemp, .true., il, c, s,
672 $ a( irow-iskew*ic+ioffst, ic ),
673 $ ilda, ctemp, extra )
675 CALL zlartg( a( irow+1-iskew*( ic+1 )+ioffst,
676 $ ic+1 ), ctemp, realc, s, dummy )
677 dummy = zlarnd( 5, iseed )
678 c = dconjg( realc*dummy )
679 s = dconjg( -s*dummy )
681 icol = max( 1, jch-jku-jkl )
684 CALL zlarot( .true., jch.GT.jku+jkl, .true.,
685 $ il, c, s, a( irow-iskew*icol+
686 $ ioffst, icol ), ilda, extra,
700 DO 90 jc = 1, min( n+jkl, m ) + jku - 1
702 angle = twopi*dlarnd( 1, iseed )
703 c = cos( angle )*zlarnd( 5, iseed )
704 s = sin( angle )*zlarnd( 5, iseed )
705 irow = max( 1, jc-jku )
707 il = min( m, jc+jkl ) + 1 - irow
708 CALL zlarot( .false., jc.GT.jku, .false., il, c,
709 $ s, a( irow-iskew*jc+ioffst, jc ),
710 $ ilda, extra, dummy )
717 DO 80 jch = jc - jku, 1, -jkl - jku
719 CALL zlartg( a( ir+1-iskew*( ic+1 )+ioffst,
720 $ ic+1 ), extra, realc, s, dummy )
721 dummy = zlarnd( 5, iseed )
722 c = dconjg( realc*dummy )
723 s = dconjg( -s*dummy )
725 icol = max( 1, jch-jkl )
729 CALL zlarot( .true., iltemp, .true., il, c, s,
730 $ a( ir-iskew*icol+ioffst, icol ),
731 $ ilda, ctemp, extra )
733 CALL zlartg( a( ir+1-iskew*( icol+1 )+ioffst,
734 $ icol+1 ), ctemp, realc, s,
736 dummy = zlarnd( 5, iseed )
737 c = dconjg( realc*dummy )
738 s = dconjg( -s*dummy )
739 irow = max( 1, jch-jkl-jku )
742 CALL zlarot( .false., jch.GT.jkl+jku, .true.,
743 $ il, c, s, a( irow-iskew*icol+
744 $ ioffst, icol ), ilda, extra,
765 iendch = min( m, n+jkl ) - 1
766 DO 120 jc = min( m+jku, n ) - 1, 1 - jkl, -1
768 angle = twopi*dlarnd( 1, iseed )
769 c = cos( angle )*zlarnd( 5, iseed )
770 s = sin( angle )*zlarnd( 5, iseed )
771 irow = max( 1, jc-jku+1 )
773 il = min( m, jc+jkl+1 ) + 1 - irow
774 CALL zlarot( .false., .false., jc+jkl.LT.m, il,
775 $ c, s, a( irow-iskew*jc+ioffst,
776 $ jc ), ilda, dummy, extra )
782 DO 110 jch = jc + jkl, iendch, jkl + jku
785 CALL zlartg( a( jch-iskew*ic+ioffst, ic ),
786 $ extra, realc, s, dummy )
787 dummy = zlarnd( 5, iseed )
792 icol = min( n-1, jch+jku )
793 iltemp = jch + jku.LT.n
795 CALL zlarot( .true., ilextr, iltemp, icol+2-ic,
796 $ c, s, a( jch-iskew*ic+ioffst, ic ),
797 $ ilda, extra, ctemp )
799 CALL zlartg( a( jch-iskew*icol+ioffst,
800 $ icol ), ctemp, realc, s, dummy )
801 dummy = zlarnd( 5, iseed )
804 il = min( iendch, jch+jkl+jku ) + 2 - jch
806 CALL zlarot( .false., .true.,
807 $ jch+jkl+jku.LE.iendch, il, c, s,
808 $ a( jch-iskew*icol+ioffst,
809 $ icol ), ilda, ctemp, extra )
824 iendch = min( n, m+jku ) - 1
825 DO 150 jr = min( n+jkl, m ) - 1, 1 - jku, -1
827 angle = twopi*dlarnd( 1, iseed )
828 c = cos( angle )*zlarnd( 5, iseed )
829 s = sin( angle )*zlarnd( 5, iseed )
830 icol = max( 1, jr-jkl+1 )
832 il = min( n, jr+jku+1 ) + 1 - icol
833 CALL zlarot( .true., .false., jr+jku.LT.n, il,
834 $ c, s, a( jr-iskew*icol+ioffst,
835 $ icol ), ilda, dummy, extra )
841 DO 140 jch = jr + jku, iendch, jkl + jku
844 CALL zlartg( a( ir-iskew*jch+ioffst, jch ),
845 $ extra, realc, s, dummy )
846 dummy = zlarnd( 5, iseed )
851 irow = min( m-1, jch+jkl )
852 iltemp = jch + jkl.LT.m
854 CALL zlarot( .false., ilextr, iltemp, irow+2-ir,
855 $ c, s, a( ir-iskew*jch+ioffst,
856 $ jch ), ilda, extra, ctemp )
858 CALL zlartg( a( irow-iskew*jch+ioffst, jch ),
859 $ ctemp, realc, s, dummy )
860 dummy = zlarnd( 5, iseed )
863 il = min( iendch, jch+jkl+jku ) + 2 - jch
865 CALL zlarot( .true., .true.,
866 $ jch+jkl+jku.LE.iendch, il, c, s,
867 $ a( irow-iskew*jch+ioffst, jch ),
868 $ ilda, ctemp, extra )
889 IF( ipack.GE.5 )
THEN
897 a( ( 1-iskew )*j+ioffg, j ) = dcmplx( d( j ) )
902 irow = max( 1, jc-k )
903 il = min( jc+1, k+2 )
905 ctemp = a( jc-iskew*( jc+1 )+ioffg, jc+1 )
906 angle = twopi*dlarnd( 1, iseed )
907 c = cos( angle )*zlarnd( 5, iseed )
908 s = sin( angle )*zlarnd( 5, iseed )
913 ctemp = dconjg( ctemp )
917 CALL zlarot( .false., jc.GT.k, .true., il, c, s,
918 $ a( irow-iskew*jc+ioffg, jc ), ilda,
920 CALL zlarot( .true., .true., .false.,
921 $ min( k, n-jc )+1, ct, st,
922 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
928 DO 180 jch = jc - k, 1, -k
929 CALL zlartg( a( jch+1-iskew*( icol+1 )+ioffg,
930 $ icol+1 ), extra, realc, s, dummy )
931 dummy = zlarnd( 5, iseed )
932 c = dconjg( realc*dummy )
933 s = dconjg( -s*dummy )
934 ctemp = a( jch-iskew*( jch+1 )+ioffg, jch+1 )
939 ctemp = dconjg( ctemp )
943 CALL zlarot( .true., .true., .true., k+2, c, s,
944 $ a( ( 1-iskew )*jch+ioffg, jch ),
945 $ ilda, ctemp, extra )
946 irow = max( 1, jch-k )
947 il = min( jch+1, k+2 )
949 CALL zlarot( .false., jch.GT.k, .true., il, ct,
950 $ st, a( irow-iskew*jch+ioffg, jch ),
951 $ ilda, extra, ctemp )
960 IF( ipack.NE.ipackg .AND. ipack.NE.3 )
THEN
962 irow = ioffst - iskew*jc
964 DO 210 jr = jc, min( n, jc+uub )
965 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
968 DO 220 jr = jc, min( n, jc+uub )
969 a( jr+irow, jc ) = dconjg( a( jc-iskew*jr+
974 IF( ipack.EQ.5 )
THEN
975 DO 250 jc = n - uub + 1, n
976 DO 240 jr = n + 2 - jc, uub + 1
981 IF( ipackg.EQ.6 )
THEN
991 IF( ipack.GE.5 )
THEN
1000 a( ( 1-iskew )*j+ioffg, j ) = dcmplx( d( j ) )
1004 DO 280 jc = n - 1, 1, -1
1005 il = min( n+1-jc, k+2 )
1007 ctemp = a( 1+( 1-iskew )*jc+ioffg, jc )
1008 angle = twopi*dlarnd( 1, iseed )
1009 c = cos( angle )*zlarnd( 5, iseed )
1010 s = sin( angle )*zlarnd( 5, iseed )
1015 ctemp = dconjg( ctemp )
1019 CALL zlarot( .false., .true., n-jc.GT.k, il, c, s,
1020 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
1022 icol = max( 1, jc-k+1 )
1023 CALL zlarot( .true., .false., .true., jc+2-icol,
1024 $ ct, st, a( jc-iskew*icol+ioffg,
1025 $ icol ), ilda, dummy, ctemp )
1030 DO 270 jch = jc + k, n - 1, k
1031 CALL zlartg( a( jch-iskew*icol+ioffg, icol ),
1032 $ extra, realc, s, dummy )
1033 dummy = zlarnd( 5, iseed )
1036 ctemp = a( 1+( 1-iskew )*jch+ioffg, jch )
1041 ctemp = dconjg( ctemp )
1045 CALL zlarot( .true., .true., .true., k+2, c, s,
1046 $ a( jch-iskew*icol+ioffg, icol ),
1047 $ ilda, extra, ctemp )
1048 il = min( n+1-jch, k+2 )
1050 CALL zlarot( .false., .true., n-jch.GT.k, il,
1051 $ ct, st, a( ( 1-iskew )*jch+ioffg,
1052 $ jch ), ilda, ctemp, extra )
1061 IF( ipack.NE.ipackg .AND. ipack.NE.4 )
THEN
1062 DO 320 jc = n, 1, -1
1063 irow = ioffst - iskew*jc
1065 DO 300 jr = jc, max( 1, jc-uub ), -1
1066 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
1069 DO 310 jr = jc, max( 1, jc-uub ), -1
1070 a( jr+irow, jc ) = dconjg( a( jc-iskew*jr+
1075 IF( ipack.EQ.6 )
THEN
1077 DO 330 jr = 1, uub + 1 - jc
1082 IF( ipackg.EQ.5 )
THEN
1092 IF( .NOT.zsym )
THEN
1094 irow = ioffst + ( 1-iskew )*jc
1095 a( irow, jc ) = dcmplx( dble( a( irow, jc ) ) )
1110 IF( isym.EQ.1 )
THEN
1114 CALL zlagge( mr, nc, llb, uub, d, a, lda, iseed, work,
1122 CALL zlagsy( m, llb, d, a, lda, iseed, work, iinfo )
1124 CALL zlaghe( m, llb, d, a, lda, iseed, work, iinfo )
1128 IF( iinfo.NE.0 )
THEN
1136 IF( ipack.NE.ipackg )
THEN
1137 IF( ipack.EQ.1 )
THEN
1147 ELSE IF( ipack.EQ.2 )
THEN
1157 ELSE IF( ipack.EQ.3 )
THEN
1166 IF( irow.GT.lda )
THEN
1170 a( irow, icol ) = a( i, j )
1174 ELSE IF( ipack.EQ.4 )
THEN
1183 IF( irow.GT.lda )
THEN
1187 a( irow, icol ) = a( i, j )
1191 ELSE IF( ipack.GE.5 )
THEN
1203 DO 440 i = min( j+llb, m ), 1, -1
1204 a( i-j+uub+1, j ) = a( i, j )
1208 DO 470 j = uub + 2, n
1209 DO 460 i = j - uub, min( j+llb, m )
1210 a( i-j+uub+1, j ) = a( i, j )
1220 IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1222 DO 480 jr = irow + 1, lda
1228 ELSE IF( ipack.GE.5 )
THEN
1239 DO 500 jr = 1, uub + 1 - jc
1242 DO 510 jr = max( 1, min( ir1, ir2-jc ) ), lda
subroutine xerbla(srname, info)
subroutine dlatm1(mode, cond, irsign, idist, iseed, d, n, info)
DLATM1
subroutine zlartg(f, g, c, s, r)
ZLARTG generates a plane rotation with real cosine and complex sine.
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine zlagge(m, n, kl, ku, d, a, lda, iseed, work, info)
ZLAGGE
subroutine zlaghe(n, k, d, a, lda, iseed, work, info)
ZLAGHE
subroutine zlagsy(n, k, d, a, lda, iseed, work, info)
ZLAGSY
subroutine zlarot(lrows, lleft, lright, nl, c, s, a, lda, xleft, xright)
ZLAROT
subroutine zlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
ZLATMS