338 SUBROUTINE zlatmt( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
339 $ RANK, KL, KU, PACK, A, LDA, WORK, INFO )
346 DOUBLE PRECISION COND, DMAX
347 INTEGER INFO, KL, KU, LDA, M, MODE, N, RANK
348 CHARACTER DIST, PACK, SYM
351 COMPLEX*16 A( LDA, * ), WORK( * )
352 DOUBLE PRECISION D( * )
359 DOUBLE PRECISION ZERO
360 parameter( zero = 0.0d+0 )
362 parameter( one = 1.0d+0 )
364 parameter( czero = ( 0.0d+0, 0.0d+0 ) )
365 DOUBLE PRECISION TWOPI
366 parameter( twopi = 6.28318530717958647692528676655900576839d+0 )
369 COMPLEX*16 C, CT, DUMMY, EXTRA, S, ST, ZTEMP
370 DOUBLE PRECISION ALPHA, ANGLE, REALC, TEMP
371 INTEGER I, IC, ICOL, IDIST, IENDCH, IINFO, IL, ILDA,
372 $ ioffg, ioffst, ipack, ipackg, ir, ir1, ir2,
373 $ irow, irsign, iskew, isym, isympk, j, jc, jch,
374 $ jkl, jku, jr, k, llb, minlda, mnmin, mr, nc,
376 LOGICAL CSYM, GIVENS, ILEXTR, ILTEMP, TOPDWN
380 DOUBLE PRECISION DLARND
382 EXTERNAL zlarnd, dlarnd, lsame
389 INTRINSIC abs, cos, dble, dcmplx, dconjg, max, min, mod,
401 IF( m.EQ.0 .OR. n.EQ.0 )
406 IF( lsame( dist,
'U' ) )
THEN
408 ELSE IF( lsame( dist,
'S' ) )
THEN
410 ELSE IF( lsame( dist,
'N' ) )
THEN
418 IF( lsame( sym,
'N' ) )
THEN
422 ELSE IF( lsame( sym,
'P' ) )
THEN
426 ELSE IF( lsame( sym,
'S' ) )
THEN
430 ELSE IF( lsame( sym,
'H' ) )
THEN
441 IF( lsame( pack,
'N' ) )
THEN
443 ELSE IF( lsame( pack,
'U' ) )
THEN
446 ELSE IF( lsame( pack,
'L' ) )
THEN
449 ELSE IF( lsame( pack,
'C' ) )
THEN
452 ELSE IF( lsame( pack,
'R' ) )
THEN
455 ELSE IF( lsame( pack,
'B' ) )
THEN
458 ELSE IF( lsame( pack,
'Q' ) )
THEN
461 ELSE IF( lsame( pack,
'Z' ) )
THEN
475 IF( ipack.EQ.5 .OR. ipack.EQ.6 )
THEN
477 ELSE IF( ipack.EQ.7 )
THEN
478 minlda = llb + uub + 1
488 IF( dble( llb+uub ).LT.0.3d0*dble( max( 1, mr+nc ) ) )
494 IF( lda.LT.m .AND. lda.GE.minlda )
501 ELSE IF( m.NE.n .AND. isym.NE.1 )
THEN
503 ELSE IF( n.LT.0 )
THEN
505 ELSE IF( idist.EQ.-1 )
THEN
507 ELSE IF( isym.EQ.-1 )
THEN
509 ELSE IF( abs( mode ).GT.6 )
THEN
511 ELSE IF( ( mode.NE.0 .AND. abs( mode ).NE.6 ) .AND. cond.LT.one )
514 ELSE IF( kl.LT.0 )
THEN
516 ELSE IF( ku.LT.0 .OR. ( isym.NE.1 .AND. kl.NE.ku ) )
THEN
518 ELSE IF( ipack.EQ.-1 .OR. ( isympk.EQ.1 .AND. isym.EQ.1 ) .OR.
519 $ ( isympk.EQ.2 .AND. isym.EQ.1 .AND. kl.GT.0 ) .OR.
520 $ ( isympk.EQ.3 .AND. isym.EQ.1 .AND. ku.GT.0 ) .OR.
521 $ ( isympk.NE.0 .AND. m.NE.n ) )
THEN
523 ELSE IF( lda.LT.max( 1, minlda ) )
THEN
528 CALL xerbla(
'ZLATMT', -info )
535 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
538 IF( mod( iseed( 4 ), 2 ).NE.1 )
539 $ iseed( 4 ) = iseed( 4 ) + 1
545 CALL dlatm7( mode, cond, irsign, idist, iseed, d, mnmin, rank,
547 IF( iinfo.NE.0 )
THEN
555 IF( abs( d( 1 ) ).LE.abs( d( rank ) ) )
THEN
561 IF( mode.NE.0 .AND. abs( mode ).NE.6 )
THEN
567 temp = max( temp, abs( d( i ) ) )
570 IF( temp.GT.zero )
THEN
577 CALL dscal( rank, alpha, d, 1 )
581 CALL zlaset(
'Full', lda, n, czero, czero, a, lda )
592 IF( ipack.GT.4 )
THEN
595 IF( ipack.GT.5 )
THEN
615 IF( llb.EQ.0 .AND. uub.EQ.0 )
THEN
617 a( ( 1-iskew )*j+ioffst, j ) = dcmplx( d( j ) )
620 IF( ipack.LE.2 .OR. ipack.GE.5 )
623 ELSE IF( givens )
THEN
632 IF( ipack.GT.4 )
THEN
639 a( ( 1-iskew )*j+ioffst, j ) = dcmplx( d( j ) )
651 DO 150 jr = 1, min( m+jku, n ) + jkl - 1
653 angle = twopi*dlarnd( 1, iseed )
654 c = cos( angle )*zlarnd( 5, iseed )
655 s = sin( angle )*zlarnd( 5, iseed )
656 icol = max( 1, jr-jkl )
658 il = min( n, jr+jku ) + 1 - icol
659 CALL zlarot( .true., jr.GT.jkl, .false., il, c,
660 $ s, a( jr-iskew*icol+ioffst, icol ),
661 $ ilda, extra, dummy )
668 DO 140 jch = jr - jkl, 1, -jkl - jku
670 CALL zlartg( a( ir+1-iskew*( ic+1 )+ioffst,
671 $ ic+1 ), extra, realc, s, dummy )
672 dummy = dlarnd( 5, iseed )
673 c = dconjg( realc*dummy )
674 s = dconjg( -s*dummy )
676 irow = max( 1, jch-jku )
680 CALL zlarot( .false., iltemp, .true., il, c, s,
681 $ a( irow-iskew*ic+ioffst, ic ),
682 $ ilda, ztemp, extra )
684 CALL zlartg( a( irow+1-iskew*( ic+1 )+ioffst,
685 $ ic+1 ), ztemp, realc, s, dummy )
686 dummy = zlarnd( 5, iseed )
687 c = dconjg( realc*dummy )
688 s = dconjg( -s*dummy )
690 icol = max( 1, jch-jku-jkl )
693 CALL zlarot( .true., jch.GT.jku+jkl, .true.,
694 $ il, c, s, a( irow-iskew*icol+
695 $ ioffst, icol ), ilda, extra,
709 DO 180 jc = 1, min( n+jkl, m ) + jku - 1
711 angle = twopi*dlarnd( 1, iseed )
712 c = cos( angle )*zlarnd( 5, iseed )
713 s = sin( angle )*zlarnd( 5, iseed )
714 irow = max( 1, jc-jku )
716 il = min( m, jc+jkl ) + 1 - irow
717 CALL zlarot( .false., jc.GT.jku, .false., il, c,
718 $ s, a( irow-iskew*jc+ioffst, jc ),
719 $ ilda, extra, dummy )
726 DO 170 jch = jc - jku, 1, -jkl - jku
728 CALL zlartg( a( ir+1-iskew*( ic+1 )+ioffst,
729 $ ic+1 ), extra, realc, s, dummy )
730 dummy = zlarnd( 5, iseed )
731 c = dconjg( realc*dummy )
732 s = dconjg( -s*dummy )
734 icol = max( 1, jch-jkl )
738 CALL zlarot( .true., iltemp, .true., il, c, s,
739 $ a( ir-iskew*icol+ioffst, icol ),
740 $ ilda, ztemp, extra )
742 CALL zlartg( a( ir+1-iskew*( icol+1 )+ioffst,
743 $ icol+1 ), ztemp, realc, s,
745 dummy = zlarnd( 5, iseed )
746 c = dconjg( realc*dummy )
747 s = dconjg( -s*dummy )
748 irow = max( 1, jch-jkl-jku )
751 CALL zlarot( .false., jch.GT.jkl+jku, .true.,
752 $ il, c, s, a( irow-iskew*icol+
753 $ ioffst, icol ), ilda, extra,
774 iendch = min( m, n+jkl ) - 1
775 DO 210 jc = min( m+jku, n ) - 1, 1 - jkl, -1
777 angle = twopi*dlarnd( 1, iseed )
778 c = cos( angle )*zlarnd( 5, iseed )
779 s = sin( angle )*zlarnd( 5, iseed )
780 irow = max( 1, jc-jku+1 )
782 il = min( m, jc+jkl+1 ) + 1 - irow
783 CALL zlarot( .false., .false., jc+jkl.LT.m, il,
784 $ c, s, a( irow-iskew*jc+ioffst,
785 $ jc ), ilda, dummy, extra )
791 DO 200 jch = jc + jkl, iendch, jkl + jku
794 CALL zlartg( a( jch-iskew*ic+ioffst, ic ),
795 $ extra, realc, s, dummy )
796 dummy = zlarnd( 5, iseed )
801 icol = min( n-1, jch+jku )
802 iltemp = jch + jku.LT.n
804 CALL zlarot( .true., ilextr, iltemp, icol+2-ic,
805 $ c, s, a( jch-iskew*ic+ioffst, ic ),
806 $ ilda, extra, ztemp )
808 CALL zlartg( a( jch-iskew*icol+ioffst,
809 $ icol ), ztemp, realc, s, dummy )
810 dummy = zlarnd( 5, iseed )
813 il = min( iendch, jch+jkl+jku ) + 2 - jch
815 CALL zlarot( .false., .true.,
816 $ jch+jkl+jku.LE.iendch, il, c, s,
817 $ a( jch-iskew*icol+ioffst,
818 $ icol ), ilda, ztemp, extra )
833 iendch = min( n, m+jku ) - 1
834 DO 240 jr = min( n+jkl, m ) - 1, 1 - jku, -1
836 angle = twopi*dlarnd( 1, iseed )
837 c = cos( angle )*zlarnd( 5, iseed )
838 s = sin( angle )*zlarnd( 5, iseed )
839 icol = max( 1, jr-jkl+1 )
841 il = min( n, jr+jku+1 ) + 1 - icol
842 CALL zlarot( .true., .false., jr+jku.LT.n, il,
843 $ c, s, a( jr-iskew*icol+ioffst,
844 $ icol ), ilda, dummy, extra )
850 DO 230 jch = jr + jku, iendch, jkl + jku
853 CALL zlartg( a( ir-iskew*jch+ioffst, jch ),
854 $ extra, realc, s, dummy )
855 dummy = zlarnd( 5, iseed )
860 irow = min( m-1, jch+jkl )
861 iltemp = jch + jkl.LT.m
863 CALL zlarot( .false., ilextr, iltemp, irow+2-ir,
864 $ c, s, a( ir-iskew*jch+ioffst,
865 $ jch ), ilda, extra, ztemp )
867 CALL zlartg( a( irow-iskew*jch+ioffst, jch ),
868 $ ztemp, realc, s, dummy )
869 dummy = zlarnd( 5, iseed )
872 il = min( iendch, jch+jkl+jku ) + 2 - jch
874 CALL zlarot( .true., .true.,
875 $ jch+jkl+jku.LE.iendch, il, c, s,
876 $ a( irow-iskew*jch+ioffst, jch ),
877 $ ilda, ztemp, extra )
898 IF( ipack.GE.5 )
THEN
906 a( ( 1-iskew )*j+ioffg, j ) = dcmplx( d( j ) )
911 irow = max( 1, jc-k )
912 il = min( jc+1, k+2 )
914 ztemp = a( jc-iskew*( jc+1 )+ioffg, jc+1 )
915 angle = twopi*dlarnd( 1, iseed )
916 c = cos( angle )*zlarnd( 5, iseed )
917 s = sin( angle )*zlarnd( 5, iseed )
922 ztemp = dconjg( ztemp )
926 CALL zlarot( .false., jc.GT.k, .true., il, c, s,
927 $ a( irow-iskew*jc+ioffg, jc ), ilda,
929 CALL zlarot( .true., .true., .false.,
930 $ min( k, n-jc )+1, ct, st,
931 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
937 DO 270 jch = jc - k, 1, -k
938 CALL zlartg( a( jch+1-iskew*( icol+1 )+ioffg,
939 $ icol+1 ), extra, realc, s, dummy )
940 dummy = zlarnd( 5, iseed )
941 c = dconjg( realc*dummy )
942 s = dconjg( -s*dummy )
943 ztemp = a( jch-iskew*( jch+1 )+ioffg, jch+1 )
948 ztemp = dconjg( ztemp )
952 CALL zlarot( .true., .true., .true., k+2, c, s,
953 $ a( ( 1-iskew )*jch+ioffg, jch ),
954 $ ilda, ztemp, extra )
955 irow = max( 1, jch-k )
956 il = min( jch+1, k+2 )
958 CALL zlarot( .false., jch.GT.k, .true., il, ct,
959 $ st, a( irow-iskew*jch+ioffg, jch ),
960 $ ilda, extra, ztemp )
969 IF( ipack.NE.ipackg .AND. ipack.NE.3 )
THEN
971 irow = ioffst - iskew*jc
973 DO 300 jr = jc, min( n, jc+uub )
974 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
977 DO 310 jr = jc, min( n, jc+uub )
978 a( jr+irow, jc ) = dconjg( a( jc-iskew*jr+
983 IF( ipack.EQ.5 )
THEN
984 DO 340 jc = n - uub + 1, n
985 DO 330 jr = n + 2 - jc, uub + 1
990 IF( ipackg.EQ.6 )
THEN
1000 IF( ipack.GE.5 )
THEN
1009 a( ( 1-iskew )*j+ioffg, j ) = dcmplx( d( j ) )
1013 DO 370 jc = n - 1, 1, -1
1014 il = min( n+1-jc, k+2 )
1016 ztemp = a( 1+( 1-iskew )*jc+ioffg, jc )
1017 angle = twopi*dlarnd( 1, iseed )
1018 c = cos( angle )*zlarnd( 5, iseed )
1019 s = sin( angle )*zlarnd( 5, iseed )
1024 ztemp = dconjg( ztemp )
1028 CALL zlarot( .false., .true., n-jc.GT.k, il, c, s,
1029 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
1031 icol = max( 1, jc-k+1 )
1032 CALL zlarot( .true., .false., .true., jc+2-icol,
1033 $ ct, st, a( jc-iskew*icol+ioffg,
1034 $ icol ), ilda, dummy, ztemp )
1039 DO 360 jch = jc + k, n - 1, k
1040 CALL zlartg( a( jch-iskew*icol+ioffg, icol ),
1041 $ extra, realc, s, dummy )
1042 dummy = zlarnd( 5, iseed )
1045 ztemp = a( 1+( 1-iskew )*jch+ioffg, jch )
1050 ztemp = dconjg( ztemp )
1054 CALL zlarot( .true., .true., .true., k+2, c, s,
1055 $ a( jch-iskew*icol+ioffg, icol ),
1056 $ ilda, extra, ztemp )
1057 il = min( n+1-jch, k+2 )
1059 CALL zlarot( .false., .true., n-jch.GT.k, il,
1060 $ ct, st, a( ( 1-iskew )*jch+ioffg,
1061 $ jch ), ilda, ztemp, extra )
1070 IF( ipack.NE.ipackg .AND. ipack.NE.4 )
THEN
1071 DO 410 jc = n, 1, -1
1072 irow = ioffst - iskew*jc
1074 DO 390 jr = jc, max( 1, jc-uub ), -1
1075 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
1078 DO 400 jr = jc, max( 1, jc-uub ), -1
1079 a( jr+irow, jc ) = dconjg( a( jc-iskew*jr+
1084 IF( ipack.EQ.6 )
THEN
1086 DO 420 jr = 1, uub + 1 - jc
1091 IF( ipackg.EQ.5 )
THEN
1101 IF( .NOT.csym )
THEN
1103 irow = ioffst + ( 1-iskew )*jc
1104 a( irow, jc ) = dcmplx( dble( a( irow, jc ) ) )
1119 IF( isym.EQ.1 )
THEN
1123 CALL zlagge( mr, nc, llb, uub, d, a, lda, iseed, work,
1131 CALL zlagsy( m, llb, d, a, lda, iseed, work, iinfo )
1133 CALL zlaghe( m, llb, d, a, lda, iseed, work, iinfo )
1137 IF( iinfo.NE.0 )
THEN
1145 IF( ipack.NE.ipackg )
THEN
1146 IF( ipack.EQ.1 )
THEN
1156 ELSE IF( ipack.EQ.2 )
THEN
1166 ELSE IF( ipack.EQ.3 )
THEN
1175 IF( irow.GT.lda )
THEN
1179 a( irow, icol ) = a( i, j )
1183 ELSE IF( ipack.EQ.4 )
THEN
1192 IF( irow.GT.lda )
THEN
1196 a( irow, icol ) = a( i, j )
1200 ELSE IF( ipack.GE.5 )
THEN
1212 DO 530 i = min( j+llb, m ), 1, -1
1213 a( i-j+uub+1, j ) = a( i, j )
1217 DO 560 j = uub + 2, n
1218 DO 550 i = j - uub, min( j+llb, m )
1219 a( i-j+uub+1, j ) = a( i, j )
1229 IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1231 DO 570 jr = irow + 1, lda
1237 ELSE IF( ipack.GE.5 )
THEN
1248 DO 590 jr = 1, uub + 1 - jc
1251 DO 600 jr = max( 1, min( ir1, ir2-jc ) ), lda
subroutine xerbla(srname, info)
subroutine dlatm7(mode, cond, irsign, idist, iseed, d, n, rank, info)
DLATM7
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 zlatmt(m, n, dist, iseed, sym, d, mode, cond, dmax, rank, kl, ku, pack, a, lda, work, info)
ZLATMT