330 SUBROUTINE clatms( 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
345 COMPLEX A( LDA, * ), WORK( * )
352 parameter( zero = 0.0e+0 )
354 parameter( one = 1.0e+0 )
356 parameter( czero = ( 0.0e+0, 0.0e+0 ) )
358 parameter( twopi = 6.28318530717958647692528676655900576839e+0 )
361 LOGICAL CSYM, GIVENS, ILEXTR, ILTEMP, TOPDWN
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 REAL ALPHA, ANGLE, REALC, TEMP
368 COMPLEX C, CT, CTEMP, DUMMY, EXTRA, S, ST
374 EXTERNAL lsame, slarnd, clarnd
381 INTRINSIC abs, cmplx, conjg, cos, max, min, mod, real,
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( real( llb+uub ).LT.0.3*real( 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(
'CLATMS', -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 slatm1( 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 sscal( mnmin, alpha, d, 1 )
572 CALL claset(
'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 ) = cmplx( 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 ) = cmplx( d( j ) )
642 DO 60 jr = 1, min( m+jku, n ) + jkl - 1
644 angle = twopi*slarnd( 1, iseed )
645 c = cos( angle )*clarnd( 5, iseed )
646 s = sin( angle )*clarnd( 5, iseed )
647 icol = max( 1, jr-jkl )
649 il = min( n, jr+jku ) + 1 - icol
650 CALL clarot( .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 clartg( a( ir+1-iskew*( ic+1 )+ioffst,
662 $ ic+1 ), extra, realc, s, dummy )
663 dummy = clarnd( 5, iseed )
664 c = conjg( realc*dummy )
665 s = conjg( -s*dummy )
667 irow = max( 1, jch-jku )
671 CALL clarot( .false., iltemp, .true., il, c, s,
672 $ a( irow-iskew*ic+ioffst, ic ),
673 $ ilda, ctemp, extra )
675 CALL clartg( a( irow+1-iskew*( ic+1 )+ioffst,
676 $ ic+1 ), ctemp, realc, s, dummy )
677 dummy = clarnd( 5, iseed )
678 c = conjg( realc*dummy )
679 s = conjg( -s*dummy )
681 icol = max( 1, jch-jku-jkl )
684 CALL clarot( .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*slarnd( 1, iseed )
703 c = cos( angle )*clarnd( 5, iseed )
704 s = sin( angle )*clarnd( 5, iseed )
705 irow = max( 1, jc-jku )
707 il = min( m, jc+jkl ) + 1 - irow
708 CALL clarot( .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 clartg( a( ir+1-iskew*( ic+1 )+ioffst,
720 $ ic+1 ), extra, realc, s, dummy )
721 dummy = clarnd( 5, iseed )
722 c = conjg( realc*dummy )
723 s = conjg( -s*dummy )
725 icol = max( 1, jch-jkl )
729 CALL clarot( .true., iltemp, .true., il, c, s,
730 $ a( ir-iskew*icol+ioffst, icol ),
731 $ ilda, ctemp, extra )
733 CALL clartg( a( ir+1-iskew*( icol+1 )+ioffst,
734 $ icol+1 ), ctemp, realc, s,
736 dummy = clarnd( 5, iseed )
737 c = conjg( realc*dummy )
738 s = conjg( -s*dummy )
739 irow = max( 1, jch-jkl-jku )
742 CALL clarot( .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*slarnd( 1, iseed )
769 c = cos( angle )*clarnd( 5, iseed )
770 s = sin( angle )*clarnd( 5, iseed )
771 irow = max( 1, jc-jku+1 )
773 il = min( m, jc+jkl+1 ) + 1 - irow
774 CALL clarot( .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 clartg( a( jch-iskew*ic+ioffst, ic ),
786 $ extra, realc, s, dummy )
787 dummy = clarnd( 5, iseed )
792 icol = min( n-1, jch+jku )
793 iltemp = jch + jku.LT.n
795 CALL clarot( .true., ilextr, iltemp, icol+2-ic,
796 $ c, s, a( jch-iskew*ic+ioffst, ic ),
797 $ ilda, extra, ctemp )
799 CALL clartg( a( jch-iskew*icol+ioffst,
800 $ icol ), ctemp, realc, s, dummy )
801 dummy = clarnd( 5, iseed )
804 il = min( iendch, jch+jkl+jku ) + 2 - jch
806 CALL clarot( .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*slarnd( 1, iseed )
828 c = cos( angle )*clarnd( 5, iseed )
829 s = sin( angle )*clarnd( 5, iseed )
830 icol = max( 1, jr-jkl+1 )
832 il = min( n, jr+jku+1 ) + 1 - icol
833 CALL clarot( .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 clartg( a( ir-iskew*jch+ioffst, jch ),
845 $ extra, realc, s, dummy )
846 dummy = clarnd( 5, iseed )
851 irow = min( m-1, jch+jkl )
852 iltemp = jch + jkl.LT.m
854 CALL clarot( .false., ilextr, iltemp, irow+2-ir,
855 $ c, s, a( ir-iskew*jch+ioffst,
856 $ jch ), ilda, extra, ctemp )
858 CALL clartg( a( irow-iskew*jch+ioffst, jch ),
859 $ ctemp, realc, s, dummy )
860 dummy = clarnd( 5, iseed )
863 il = min( iendch, jch+jkl+jku ) + 2 - jch
865 CALL clarot( .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 ) = cmplx( 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*slarnd( 1, iseed )
907 c = cos( angle )*clarnd( 5, iseed )
908 s = sin( angle )*clarnd( 5, iseed )
913 ctemp = conjg( ctemp )
917 CALL clarot( .false., jc.GT.k, .true., il, c, s,
918 $ a( irow-iskew*jc+ioffg, jc ), ilda,
920 CALL clarot( .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 clartg( a( jch+1-iskew*( icol+1 )+ioffg,
930 $ icol+1 ), extra, realc, s, dummy )
931 dummy = clarnd( 5, iseed )
932 c = conjg( realc*dummy )
933 s = conjg( -s*dummy )
934 ctemp = a( jch-iskew*( jch+1 )+ioffg, jch+1 )
939 ctemp = conjg( ctemp )
943 CALL clarot( .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 clarot( .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 ) = conjg( 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 ) = cmplx( 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*slarnd( 1, iseed )
1009 c = cos( angle )*clarnd( 5, iseed )
1010 s = sin( angle )*clarnd( 5, iseed )
1015 ctemp = conjg( ctemp )
1019 CALL clarot( .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 clarot( .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 clartg( a( jch-iskew*icol+ioffg, icol ),
1032 $ extra, realc, s, dummy )
1033 dummy = clarnd( 5, iseed )
1036 ctemp = a( 1+( 1-iskew )*jch+ioffg, jch )
1041 ctemp = conjg( ctemp )
1045 CALL clarot( .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 clarot( .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 ) = conjg( 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.csym )
THEN
1094 irow = ioffst + ( 1-iskew )*jc
1095 a( irow, jc ) = cmplx( real( a( irow, jc ) ) )
1110 IF( isym.EQ.1 )
THEN
1114 CALL clagge( mr, nc, llb, uub, d, a, lda, iseed, work,
1122 CALL clagsy( m, llb, d, a, lda, iseed, work, iinfo )
1124 CALL claghe( 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 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 clatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
CLATMS
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 slatm1(mode, cond, irsign, idist, iseed, d, n, info)
SLATM1