338 SUBROUTINE clatmt( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
339 $ RANK, KL, KU, PACK, A, LDA, WORK, INFO )
347 INTEGER INFO, KL, KU, LDA, M, MODE, N, RANK
348 CHARACTER DIST, PACK, SYM
351 COMPLEX A( LDA, * ), WORK( * )
360 parameter( zero = 0.0e+0 )
362 parameter( one = 1.0e+0 )
364 parameter( czero = ( 0.0e+0, 0.0e+0 ) )
366 parameter( twopi = 6.28318530717958647692528676655900576839e+0 )
369 COMPLEX C, CT, CTEMP, DUMMY, EXTRA, S, ST
370 REAL 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
382 EXTERNAL clarnd, slarnd, lsame
389 INTRINSIC abs, cmplx, conjg, cos, max, min, mod, real,
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( real( llb+uub ).LT.0.3*real( 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(
'CLATMT', -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 slatm7( 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 sscal( rank, alpha, d, 1 )
581 CALL claset(
'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 ) = cmplx( 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 ) = cmplx( d( j ) )
651 DO 150 jr = 1, min( m+jku, n ) + jkl - 1
653 angle = twopi*slarnd( 1, iseed )
654 c = cos( angle )*clarnd( 5, iseed )
655 s = sin( angle )*clarnd( 5, iseed )
656 icol = max( 1, jr-jkl )
658 il = min( n, jr+jku ) + 1 - icol
659 CALL clarot( .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 clartg( a( ir+1-iskew*( ic+1 )+ioffst,
671 $ ic+1 ), extra, realc, s, dummy )
672 dummy = clarnd( 5, iseed )
673 c = conjg( realc*dummy )
674 s = conjg( -s*dummy )
676 irow = max( 1, jch-jku )
680 CALL clarot( .false., iltemp, .true., il, c, s,
681 $ a( irow-iskew*ic+ioffst, ic ),
682 $ ilda, ctemp, extra )
684 CALL clartg( a( irow+1-iskew*( ic+1 )+ioffst,
685 $ ic+1 ), ctemp, realc, s, dummy )
686 dummy = clarnd( 5, iseed )
687 c = conjg( realc*dummy )
688 s = conjg( -s*dummy )
690 icol = max( 1, jch-jku-jkl )
693 CALL clarot( .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*slarnd( 1, iseed )
712 c = cos( angle )*clarnd( 5, iseed )
713 s = sin( angle )*clarnd( 5, iseed )
714 irow = max( 1, jc-jku )
716 il = min( m, jc+jkl ) + 1 - irow
717 CALL clarot( .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 clartg( a( ir+1-iskew*( ic+1 )+ioffst,
729 $ ic+1 ), extra, realc, s, dummy )
730 dummy = clarnd( 5, iseed )
731 c = conjg( realc*dummy )
732 s = conjg( -s*dummy )
734 icol = max( 1, jch-jkl )
738 CALL clarot( .true., iltemp, .true., il, c, s,
739 $ a( ir-iskew*icol+ioffst, icol ),
740 $ ilda, ctemp, extra )
742 CALL clartg( a( ir+1-iskew*( icol+1 )+ioffst,
743 $ icol+1 ), ctemp, realc, s,
745 dummy = clarnd( 5, iseed )
746 c = conjg( realc*dummy )
747 s = conjg( -s*dummy )
748 irow = max( 1, jch-jkl-jku )
751 CALL clarot( .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*slarnd( 1, iseed )
778 c = cos( angle )*clarnd( 5, iseed )
779 s = sin( angle )*clarnd( 5, iseed )
780 irow = max( 1, jc-jku+1 )
782 il = min( m, jc+jkl+1 ) + 1 - irow
783 CALL clarot( .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 clartg( a( jch-iskew*ic+ioffst, ic ),
795 $ extra, realc, s, dummy )
796 dummy = clarnd( 5, iseed )
801 icol = min( n-1, jch+jku )
802 iltemp = jch + jku.LT.n
804 CALL clarot( .true., ilextr, iltemp, icol+2-ic,
805 $ c, s, a( jch-iskew*ic+ioffst, ic ),
806 $ ilda, extra, ctemp )
808 CALL clartg( a( jch-iskew*icol+ioffst,
809 $ icol ), ctemp, realc, s, dummy )
810 dummy = clarnd( 5, iseed )
813 il = min( iendch, jch+jkl+jku ) + 2 - jch
815 CALL clarot( .false., .true.,
816 $ jch+jkl+jku.LE.iendch, il, c, s,
817 $ a( jch-iskew*icol+ioffst,
818 $ icol ), ilda, ctemp, extra )
833 iendch = min( n, m+jku ) - 1
834 DO 240 jr = min( n+jkl, m ) - 1, 1 - jku, -1
836 angle = twopi*slarnd( 1, iseed )
837 c = cos( angle )*clarnd( 5, iseed )
838 s = sin( angle )*clarnd( 5, iseed )
839 icol = max( 1, jr-jkl+1 )
841 il = min( n, jr+jku+1 ) + 1 - icol
842 CALL clarot( .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 clartg( a( ir-iskew*jch+ioffst, jch ),
854 $ extra, realc, s, dummy )
855 dummy = clarnd( 5, iseed )
860 irow = min( m-1, jch+jkl )
861 iltemp = jch + jkl.LT.m
863 CALL clarot( .false., ilextr, iltemp, irow+2-ir,
864 $ c, s, a( ir-iskew*jch+ioffst,
865 $ jch ), ilda, extra, ctemp )
867 CALL clartg( a( irow-iskew*jch+ioffst, jch ),
868 $ ctemp, realc, s, dummy )
869 dummy = clarnd( 5, iseed )
872 il = min( iendch, jch+jkl+jku ) + 2 - jch
874 CALL clarot( .true., .true.,
875 $ jch+jkl+jku.LE.iendch, il, c, s,
876 $ a( irow-iskew*jch+ioffst, jch ),
877 $ ilda, ctemp, extra )
898 IF( ipack.GE.5 )
THEN
906 a( ( 1-iskew )*j+ioffg, j ) = cmplx( d( j ) )
911 irow = max( 1, jc-k )
912 il = min( jc+1, k+2 )
914 ctemp = a( jc-iskew*( jc+1 )+ioffg, jc+1 )
915 angle = twopi*slarnd( 1, iseed )
916 c = cos( angle )*clarnd( 5, iseed )
917 s = sin( angle )*clarnd( 5, iseed )
922 ctemp = conjg( ctemp )
926 CALL clarot( .false., jc.GT.k, .true., il, c, s,
927 $ a( irow-iskew*jc+ioffg, jc ), ilda,
929 CALL clarot( .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 clartg( a( jch+1-iskew*( icol+1 )+ioffg,
939 $ icol+1 ), extra, realc, s, dummy )
940 dummy = clarnd( 5, iseed )
941 c = conjg( realc*dummy )
942 s = conjg( -s*dummy )
943 ctemp = a( jch-iskew*( jch+1 )+ioffg, jch+1 )
948 ctemp = conjg( ctemp )
952 CALL clarot( .true., .true., .true., k+2, c, s,
953 $ a( ( 1-iskew )*jch+ioffg, jch ),
954 $ ilda, ctemp, extra )
955 irow = max( 1, jch-k )
956 il = min( jch+1, k+2 )
958 CALL clarot( .false., jch.GT.k, .true., il, ct,
959 $ st, a( irow-iskew*jch+ioffg, jch ),
960 $ ilda, extra, ctemp )
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 ) = conjg( 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 ) = cmplx( d( j ) )
1013 DO 370 jc = n - 1, 1, -1
1014 il = min( n+1-jc, k+2 )
1016 ctemp = a( 1+( 1-iskew )*jc+ioffg, jc )
1017 angle = twopi*slarnd( 1, iseed )
1018 c = cos( angle )*clarnd( 5, iseed )
1019 s = sin( angle )*clarnd( 5, iseed )
1024 ctemp = conjg( ctemp )
1028 CALL clarot( .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 clarot( .true., .false., .true., jc+2-icol,
1033 $ ct, st, a( jc-iskew*icol+ioffg,
1034 $ icol ), ilda, dummy, ctemp )
1039 DO 360 jch = jc + k, n - 1, k
1040 CALL clartg( a( jch-iskew*icol+ioffg, icol ),
1041 $ extra, realc, s, dummy )
1042 dummy = clarnd( 5, iseed )
1045 ctemp = a( 1+( 1-iskew )*jch+ioffg, jch )
1050 ctemp = conjg( ctemp )
1054 CALL clarot( .true., .true., .true., k+2, c, s,
1055 $ a( jch-iskew*icol+ioffg, icol ),
1056 $ ilda, extra, ctemp )
1057 il = min( n+1-jch, k+2 )
1059 CALL clarot( .false., .true., n-jch.GT.k, il,
1060 $ ct, st, a( ( 1-iskew )*jch+ioffg,
1061 $ jch ), ilda, ctemp, 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 ) = conjg( 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 ) = cmplx( real( a( irow, jc ) ) )
1119 IF( isym.EQ.1 )
THEN
1123 CALL clagge( mr, nc, llb, uub, d, a, lda, iseed, work,
1131 CALL clagsy( m, llb, d, a, lda, iseed, work, iinfo )
1133 CALL claghe( 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 clagge(m, n, kl, ku, d, a, lda, iseed, work, info)
CLAGGE
subroutine claghe(n, k, d, a, lda, iseed, work, info)
CLAGHE
subroutine clagsy(n, k, d, a, lda, iseed, work, info)
CLAGSY
subroutine clarot(lrows, lleft, lright, nl, c, s, a, lda, xleft, xright)
CLAROT
subroutine clatmt(m, n, dist, iseed, sym, d, mode, cond, dmax, rank, kl, ku, pack, a, lda, work, info)
CLATMT
subroutine clartg(f, g, c, s, r)
CLARTG generates a plane rotation with real cosine and complex sine.
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine slatm7(mode, cond, irsign, idist, iseed, d, n, rank, info)
SLATM7