319 SUBROUTINE slatms( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
320 $ KL, KU, PACK, A, LDA, WORK, INFO )
327 CHARACTER DIST, PACK, SYM
328 INTEGER INFO, KL, KU, LDA, M, MODE, N
333 REAL A( LDA, * ), D( * ), WORK( * )
340 parameter( zero = 0.0e0 )
342 parameter( one = 1.0e0 )
344 parameter( twopi = 6.28318530717958647692528676655900576839e+0 )
347 LOGICAL GIVENS, ILEXTR, ILTEMP, TOPDWN
348 INTEGER I, IC, ICOL, IDIST, IENDCH, IINFO, IL, ILDA,
349 $ ioffg, ioffst, ipack, ipackg, ir, ir1, ir2,
350 $ irow, irsign, iskew, isym, isympk, j, jc, jch,
351 $ jkl, jku, jr, k, llb, minlda, mnmin, mr, nc,
353 REAL ALPHA, ANGLE, C, DUMMY, EXTRA, S, TEMP
358 EXTERNAL lsame, slarnd
365 INTRINSIC abs, cos, max, min, mod, real, sin
376 IF( m.EQ.0 .OR. n.EQ.0 )
381 IF( lsame( dist,
'U' ) )
THEN
383 ELSE IF( lsame( dist,
'S' ) )
THEN
385 ELSE IF( lsame( dist,
'N' ) )
THEN
393 IF( lsame( sym,
'N' ) )
THEN
396 ELSE IF( lsame( sym,
'P' ) )
THEN
399 ELSE IF( lsame( sym,
'S' ) )
THEN
402 ELSE IF( lsame( sym,
'H' ) )
THEN
412 IF( lsame( pack,
'N' ) )
THEN
414 ELSE IF( lsame( pack,
'U' ) )
THEN
417 ELSE IF( lsame( pack,
'L' ) )
THEN
420 ELSE IF( lsame( pack,
'C' ) )
THEN
423 ELSE IF( lsame( pack,
'R' ) )
THEN
426 ELSE IF( lsame( pack,
'B' ) )
THEN
429 ELSE IF( lsame( pack,
'Q' ) )
THEN
432 ELSE IF( lsame( pack,
'Z' ) )
THEN
446 IF( ipack.EQ.5 .OR. ipack.EQ.6 )
THEN
448 ELSE IF( ipack.EQ.7 )
THEN
449 minlda = llb + uub + 1
459 IF( real( llb+uub ).LT.0.3*real( max( 1, mr+nc ) ) )
465 IF( lda.LT.m .AND. lda.GE.minlda )
472 ELSE IF( m.NE.n .AND. isym.NE.1 )
THEN
474 ELSE IF( n.LT.0 )
THEN
476 ELSE IF( idist.EQ.-1 )
THEN
478 ELSE IF( isym.EQ.-1 )
THEN
480 ELSE IF( abs( mode ).GT.6 )
THEN
482 ELSE IF( ( mode.NE.0 .AND. abs( mode ).NE.6 ) .AND. cond.LT.one )
485 ELSE IF( kl.LT.0 )
THEN
487 ELSE IF( ku.LT.0 .OR. ( isym.NE.1 .AND. kl.NE.ku ) )
THEN
489 ELSE IF( ipack.EQ.-1 .OR. ( isympk.EQ.1 .AND. isym.EQ.1 ) .OR.
490 $ ( isympk.EQ.2 .AND. isym.EQ.1 .AND. kl.GT.0 ) .OR.
491 $ ( isympk.EQ.3 .AND. isym.EQ.1 .AND. ku.GT.0 ) .OR.
492 $ ( isympk.NE.0 .AND. m.NE.n ) )
THEN
494 ELSE IF( lda.LT.max( 1, minlda ) )
THEN
499 CALL xerbla(
'SLATMS', -info )
506 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
509 IF( mod( iseed( 4 ), 2 ).NE.1 )
510 $ iseed( 4 ) = iseed( 4 ) + 1
516 CALL slatm1( mode, cond, irsign, idist, iseed, d, mnmin, iinfo )
517 IF( iinfo.NE.0 )
THEN
525 IF( abs( d( 1 ) ).LE.abs( d( mnmin ) ) )
THEN
531 IF( mode.NE.0 .AND. abs( mode ).NE.6 )
THEN
537 temp = max( temp, abs( d( i ) ) )
540 IF( temp.GT.zero )
THEN
547 CALL sscal( mnmin, alpha, d, 1 )
560 IF( ipack.GT.4 )
THEN
563 IF( ipack.GT.5 )
THEN
579 CALL slaset(
'Full', lda, n, zero, zero, a, lda )
584 IF( llb.EQ.0 .AND. uub.EQ.0 )
THEN
585 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffst, 1 ), ilda+1 )
586 IF( ipack.LE.2 .OR. ipack.GE.5 )
589 ELSE IF( givens )
THEN
598 IF( ipack.GT.4 )
THEN
604 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffst, 1 ), ilda+1 )
615 DO 40 jr = 1, min( m+jku, n ) + jkl - 1
617 angle = twopi*slarnd( 1, iseed )
620 icol = max( 1, jr-jkl )
622 il = min( n, jr+jku ) + 1 - icol
623 CALL slarot( .true., jr.GT.jkl, .false., il, c,
624 $ s, a( jr-iskew*icol+ioffst, icol ),
625 $ ilda, extra, dummy )
632 DO 30 jch = jr - jkl, 1, -jkl - jku
634 CALL slartg( a( ir+1-iskew*( ic+1 )+ioffst,
635 $ ic+1 ), extra, c, s, dummy )
637 irow = max( 1, jch-jku )
641 CALL slarot( .false., iltemp, .true., il, c, -s,
642 $ a( irow-iskew*ic+ioffst, ic ),
643 $ ilda, temp, extra )
645 CALL slartg( a( irow+1-iskew*( ic+1 )+ioffst,
646 $ ic+1 ), temp, c, s, dummy )
647 icol = max( 1, jch-jku-jkl )
650 CALL slarot( .true., jch.GT.jku+jkl, .true.,
651 $ il, c, -s, a( irow-iskew*icol+
652 $ ioffst, icol ), ilda, extra,
666 DO 70 jc = 1, min( n+jkl, m ) + jku - 1
668 angle = twopi*slarnd( 1, iseed )
671 irow = max( 1, jc-jku )
673 il = min( m, jc+jkl ) + 1 - irow
674 CALL slarot( .false., jc.GT.jku, .false., il, c,
675 $ s, a( irow-iskew*jc+ioffst, jc ),
676 $ ilda, extra, dummy )
683 DO 60 jch = jc - jku, 1, -jkl - jku
685 CALL slartg( a( ir+1-iskew*( ic+1 )+ioffst,
686 $ ic+1 ), extra, c, s, dummy )
688 icol = max( 1, jch-jkl )
692 CALL slarot( .true., iltemp, .true., il, c, -s,
693 $ a( ir-iskew*icol+ioffst, icol ),
694 $ ilda, temp, extra )
696 CALL slartg( a( ir+1-iskew*( icol+1 )+ioffst,
697 $ icol+1 ), temp, c, s, dummy )
698 irow = max( 1, jch-jkl-jku )
701 CALL slarot( .false., jch.GT.jkl+jku, .true.,
702 $ il, c, -s, a( irow-iskew*icol+
703 $ ioffst, icol ), ilda, extra,
724 iendch = min( m, n+jkl ) - 1
725 DO 100 jc = min( m+jku, n ) - 1, 1 - jkl, -1
727 angle = twopi*slarnd( 1, iseed )
730 irow = max( 1, jc-jku+1 )
732 il = min( m, jc+jkl+1 ) + 1 - irow
733 CALL slarot( .false., .false., jc+jkl.LT.m, il,
734 $ c, s, a( irow-iskew*jc+ioffst,
735 $ jc ), ilda, dummy, extra )
741 DO 90 jch = jc + jkl, iendch, jkl + jku
744 CALL slartg( a( jch-iskew*ic+ioffst, ic ),
745 $ extra, c, s, dummy )
748 icol = min( n-1, jch+jku )
749 iltemp = jch + jku.LT.n
751 CALL slarot( .true., ilextr, iltemp, icol+2-ic,
752 $ c, s, a( jch-iskew*ic+ioffst, ic ),
753 $ ilda, extra, temp )
755 CALL slartg( a( jch-iskew*icol+ioffst,
756 $ icol ), temp, c, s, dummy )
757 il = min( iendch, jch+jkl+jku ) + 2 - jch
759 CALL slarot( .false., .true.,
760 $ jch+jkl+jku.LE.iendch, il, c, s,
761 $ a( jch-iskew*icol+ioffst,
762 $ icol ), ilda, temp, extra )
777 iendch = min( n, m+jku ) - 1
778 DO 130 jr = min( n+jkl, m ) - 1, 1 - jku, -1
780 angle = twopi*slarnd( 1, iseed )
783 icol = max( 1, jr-jkl+1 )
785 il = min( n, jr+jku+1 ) + 1 - icol
786 CALL slarot( .true., .false., jr+jku.LT.n, il,
787 $ c, s, a( jr-iskew*icol+ioffst,
788 $ icol ), ilda, dummy, extra )
794 DO 120 jch = jr + jku, iendch, jkl + jku
797 CALL slartg( a( ir-iskew*jch+ioffst, jch ),
798 $ extra, c, s, dummy )
801 irow = min( m-1, jch+jkl )
802 iltemp = jch + jkl.LT.m
804 CALL slarot( .false., ilextr, iltemp, irow+2-ir,
805 $ c, s, a( ir-iskew*jch+ioffst,
806 $ jch ), ilda, extra, temp )
808 CALL slartg( a( irow-iskew*jch+ioffst, jch ),
809 $ temp, c, s, dummy )
810 il = min( iendch, jch+jkl+jku ) + 2 - jch
812 CALL slarot( .true., .true.,
813 $ jch+jkl+jku.LE.iendch, il, c, s,
814 $ a( irow-iskew*jch+ioffst, jch ),
815 $ ilda, temp, extra )
834 IF( ipack.GE.5 )
THEN
840 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffg, 1 ), ilda+1 )
844 irow = max( 1, jc-k )
845 il = min( jc+1, k+2 )
847 temp = a( jc-iskew*( jc+1 )+ioffg, jc+1 )
848 angle = twopi*slarnd( 1, iseed )
851 CALL slarot( .false., jc.GT.k, .true., il, c, s,
852 $ a( irow-iskew*jc+ioffg, jc ), ilda,
854 CALL slarot( .true., .true., .false.,
855 $ min( k, n-jc )+1, c, s,
856 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
862 DO 150 jch = jc - k, 1, -k
863 CALL slartg( a( jch+1-iskew*( icol+1 )+ioffg,
864 $ icol+1 ), extra, c, s, dummy )
865 temp = a( jch-iskew*( jch+1 )+ioffg, jch+1 )
866 CALL slarot( .true., .true., .true., k+2, c, -s,
867 $ a( ( 1-iskew )*jch+ioffg, jch ),
868 $ ilda, temp, extra )
869 irow = max( 1, jch-k )
870 il = min( jch+1, k+2 )
872 CALL slarot( .false., jch.GT.k, .true., il, c,
873 $ -s, a( irow-iskew*jch+ioffg, jch ),
874 $ ilda, extra, temp )
883 IF( ipack.NE.ipackg .AND. ipack.NE.3 )
THEN
885 irow = ioffst - iskew*jc
886 DO 180 jr = jc, min( n, jc+uub )
887 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
890 IF( ipack.EQ.5 )
THEN
891 DO 210 jc = n - uub + 1, n
892 DO 200 jr = n + 2 - jc, uub + 1
897 IF( ipackg.EQ.6 )
THEN
907 IF( ipack.GE.5 )
THEN
914 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffg, 1 ), ilda+1 )
917 DO 230 jc = n - 1, 1, -1
918 il = min( n+1-jc, k+2 )
920 temp = a( 1+( 1-iskew )*jc+ioffg, jc )
921 angle = twopi*slarnd( 1, iseed )
924 CALL slarot( .false., .true., n-jc.GT.k, il, c, s,
925 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
927 icol = max( 1, jc-k+1 )
928 CALL slarot( .true., .false., .true., jc+2-icol, c,
929 $ s, a( jc-iskew*icol+ioffg, icol ),
930 $ ilda, dummy, temp )
935 DO 220 jch = jc + k, n - 1, k
936 CALL slartg( a( jch-iskew*icol+ioffg, icol ),
937 $ extra, c, s, dummy )
938 temp = a( 1+( 1-iskew )*jch+ioffg, jch )
939 CALL slarot( .true., .true., .true., k+2, c, s,
940 $ a( jch-iskew*icol+ioffg, icol ),
941 $ ilda, extra, temp )
942 il = min( n+1-jch, k+2 )
944 CALL slarot( .false., .true., n-jch.GT.k, il, c,
945 $ s, a( ( 1-iskew )*jch+ioffg, jch ),
946 $ ilda, temp, extra )
955 IF( ipack.NE.ipackg .AND. ipack.NE.4 )
THEN
957 irow = ioffst - iskew*jc
958 DO 250 jr = jc, max( 1, jc-uub ), -1
959 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
962 IF( ipack.EQ.6 )
THEN
964 DO 270 jr = 1, uub + 1 - jc
969 IF( ipackg.EQ.5 )
THEN
991 CALL slagge( mr, nc, llb, uub, d, a, lda, iseed, work,
997 CALL slagsy( m, llb, d, a, lda, iseed, work, iinfo )
1000 IF( iinfo.NE.0 )
THEN
1008 IF( ipack.NE.ipackg )
THEN
1009 IF( ipack.EQ.1 )
THEN
1019 ELSE IF( ipack.EQ.2 )
THEN
1029 ELSE IF( ipack.EQ.3 )
THEN
1038 IF( irow.GT.lda )
THEN
1042 a( irow, icol ) = a( i, j )
1046 ELSE IF( ipack.EQ.4 )
THEN
1055 IF( irow.GT.lda )
THEN
1059 a( irow, icol ) = a( i, j )
1063 ELSE IF( ipack.GE.5 )
THEN
1075 DO 370 i = min( j+llb, m ), 1, -1
1076 a( i-j+uub+1, j ) = a( i, j )
1080 DO 400 j = uub + 2, n
1081 DO 390 i = j - uub, min( j+llb, m )
1082 a( i-j+uub+1, j ) = a( i, j )
1092 IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1094 DO 410 jr = irow + 1, lda
1100 ELSE IF( ipack.GE.5 )
THEN
1111 DO 430 jr = 1, uub + 1 - jc
1114 DO 440 jr = max( 1, min( ir1, ir2-jc ) ), lda
subroutine xerbla(srname, info)
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
subroutine slartg(f, g, c, s, r)
SLARTG generates a plane rotation with real cosine and real sine.
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine slagge(m, n, kl, ku, d, a, lda, iseed, work, info)
SLAGGE
subroutine slagsy(n, k, d, a, lda, iseed, work, info)
SLAGSY
subroutine slarot(lrows, lleft, lright, nl, c, s, a, lda, xleft, xright)
SLAROT
subroutine slatm1(mode, cond, irsign, idist, iseed, d, n, info)
SLATM1
subroutine slatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
SLATMS