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
366 INTRINSIC abs, cos, max, min, mod, real, sin
377 IF( m.EQ.0 .OR. n.EQ.0 )
382 IF( lsame( dist,
'U' ) )
THEN
384 ELSE IF( lsame( dist,
'S' ) )
THEN
386 ELSE IF( lsame( dist,
'N' ) )
THEN
394 IF( lsame( sym,
'N' ) )
THEN
397 ELSE IF( lsame( sym,
'P' ) )
THEN
400 ELSE IF( lsame( sym,
'S' ) )
THEN
403 ELSE IF( lsame( sym,
'H' ) )
THEN
413 IF( lsame( pack,
'N' ) )
THEN
415 ELSE IF( lsame( pack,
'U' ) )
THEN
418 ELSE IF( lsame( pack,
'L' ) )
THEN
421 ELSE IF( lsame( pack,
'C' ) )
THEN
424 ELSE IF( lsame( pack,
'R' ) )
THEN
427 ELSE IF( lsame( pack,
'B' ) )
THEN
430 ELSE IF( lsame( pack,
'Q' ) )
THEN
433 ELSE IF( lsame( pack,
'Z' ) )
THEN
447 IF( ipack.EQ.5 .OR. ipack.EQ.6 )
THEN
449 ELSE IF( ipack.EQ.7 )
THEN
450 minlda = llb + uub + 1
460 IF( real( llb+uub ).LT.0.3*real( max( 1, mr+nc ) ) )
466 IF( lda.LT.m .AND. lda.GE.minlda )
473 ELSE IF( m.NE.n .AND. isym.NE.1 )
THEN
475 ELSE IF( n.LT.0 )
THEN
477 ELSE IF( idist.EQ.-1 )
THEN
479 ELSE IF( isym.EQ.-1 )
THEN
481 ELSE IF( abs( mode ).GT.6 )
THEN
483 ELSE IF( ( mode.NE.0 .AND. abs( mode ).NE.6 ) .AND. cond.LT.one )
486 ELSE IF( kl.LT.0 )
THEN
488 ELSE IF( ku.LT.0 .OR. ( isym.NE.1 .AND. kl.NE.ku ) )
THEN
490 ELSE IF( ipack.EQ.-1 .OR. ( isympk.EQ.1 .AND. isym.EQ.1 ) .OR.
491 $ ( isympk.EQ.2 .AND. isym.EQ.1 .AND. kl.GT.0 ) .OR.
492 $ ( isympk.EQ.3 .AND. isym.EQ.1 .AND. ku.GT.0 ) .OR.
493 $ ( isympk.NE.0 .AND. m.NE.n ) )
THEN
495 ELSE IF( lda.LT.max( 1, minlda ) )
THEN
500 CALL xerbla(
'SLATMS', -info )
507 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
510 IF( mod( iseed( 4 ), 2 ).NE.1 )
511 $ iseed( 4 ) = iseed( 4 ) + 1
517 CALL slatm1( mode, cond, irsign, idist, iseed, d, mnmin,
519 IF( iinfo.NE.0 )
THEN
527 IF( abs( d( 1 ) ).LE.abs( d( mnmin ) ) )
THEN
533 IF( mode.NE.0 .AND. abs( mode ).NE.6 )
THEN
539 temp = max( temp, abs( d( i ) ) )
542 IF( temp.GT.zero )
THEN
549 CALL sscal( mnmin, alpha, d, 1 )
562 IF( ipack.GT.4 )
THEN
565 IF( ipack.GT.5 )
THEN
581 CALL slaset(
'Full', lda, n, zero, zero, a, lda )
586 IF( llb.EQ.0 .AND. uub.EQ.0 )
THEN
587 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffst, 1 ), ilda+1 )
588 IF( ipack.LE.2 .OR. ipack.GE.5 )
591 ELSE IF( givens )
THEN
600 IF( ipack.GT.4 )
THEN
606 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffst, 1 ), ilda+1 )
617 DO 40 jr = 1, min( m+jku, n ) + jkl - 1
619 angle = twopi*slarnd( 1, iseed )
622 icol = max( 1, jr-jkl )
624 il = min( n, jr+jku ) + 1 - icol
625 CALL slarot( .true., jr.GT.jkl, .false., il,
627 $ s, a( jr-iskew*icol+ioffst, icol ),
628 $ ilda, extra, dummy )
635 DO 30 jch = jr - jkl, 1, -jkl - jku
637 CALL slartg( a( ir+1-iskew*( ic+1 )+ioffst,
638 $ ic+1 ), extra, c, s, dummy )
640 irow = max( 1, jch-jku )
644 CALL slarot( .false., iltemp, .true., il, c,
646 $ a( irow-iskew*ic+ioffst, ic ),
647 $ ilda, temp, extra )
649 CALL slartg( a( irow+1-iskew*( ic+1 )+ioffst,
650 $ ic+1 ), temp, c, s, dummy )
651 icol = max( 1, jch-jku-jkl )
654 CALL slarot( .true., jch.GT.jku+jkl,
656 $ il, c, -s, a( irow-iskew*icol+
657 $ ioffst, icol ), ilda, extra,
671 DO 70 jc = 1, min( n+jkl, m ) + jku - 1
673 angle = twopi*slarnd( 1, iseed )
676 irow = max( 1, jc-jku )
678 il = min( m, jc+jkl ) + 1 - irow
679 CALL slarot( .false., jc.GT.jku, .false., il,
681 $ s, a( irow-iskew*jc+ioffst, jc ),
682 $ ilda, extra, dummy )
689 DO 60 jch = jc - jku, 1, -jkl - jku
691 CALL slartg( a( ir+1-iskew*( ic+1 )+ioffst,
692 $ ic+1 ), extra, c, s, dummy )
694 icol = max( 1, jch-jkl )
698 CALL slarot( .true., iltemp, .true., il, c,
700 $ a( ir-iskew*icol+ioffst, icol ),
701 $ ilda, temp, extra )
703 CALL slartg( a( ir+1-iskew*( icol+1 )+ioffst,
704 $ icol+1 ), temp, c, s, dummy )
705 irow = max( 1, jch-jkl-jku )
708 CALL slarot( .false., jch.GT.jkl+jku,
710 $ il, c, -s, a( irow-iskew*icol+
711 $ ioffst, icol ), ilda, extra,
732 iendch = min( m, n+jkl ) - 1
733 DO 100 jc = min( m+jku, n ) - 1, 1 - jkl, -1
735 angle = twopi*slarnd( 1, iseed )
738 irow = max( 1, jc-jku+1 )
740 il = min( m, jc+jkl+1 ) + 1 - irow
741 CALL slarot( .false., .false., jc+jkl.LT.m,
743 $ c, s, a( irow-iskew*jc+ioffst,
744 $ jc ), ilda, dummy, extra )
750 DO 90 jch = jc + jkl, iendch, jkl + jku
753 CALL slartg( a( jch-iskew*ic+ioffst, ic ),
754 $ extra, c, s, dummy )
757 icol = min( n-1, jch+jku )
758 iltemp = jch + jku.LT.n
760 CALL slarot( .true., ilextr, iltemp,
762 $ c, s, a( jch-iskew*ic+ioffst, ic ),
763 $ ilda, extra, temp )
765 CALL slartg( a( jch-iskew*icol+ioffst,
766 $ icol ), temp, c, s, dummy )
767 il = min( iendch, jch+jkl+jku ) + 2 - jch
769 CALL slarot( .false., .true.,
770 $ jch+jkl+jku.LE.iendch, il, c, s,
771 $ a( jch-iskew*icol+ioffst,
772 $ icol ), ilda, temp, extra )
787 iendch = min( n, m+jku ) - 1
788 DO 130 jr = min( n+jkl, m ) - 1, 1 - jku, -1
790 angle = twopi*slarnd( 1, iseed )
793 icol = max( 1, jr-jkl+1 )
795 il = min( n, jr+jku+1 ) + 1 - icol
796 CALL slarot( .true., .false., jr+jku.LT.n,
798 $ c, s, a( jr-iskew*icol+ioffst,
799 $ icol ), ilda, dummy, extra )
805 DO 120 jch = jr + jku, iendch, jkl + jku
808 CALL slartg( a( ir-iskew*jch+ioffst, jch ),
809 $ extra, c, s, dummy )
812 irow = min( m-1, jch+jkl )
813 iltemp = jch + jkl.LT.m
815 CALL slarot( .false., ilextr, iltemp,
817 $ c, s, a( ir-iskew*jch+ioffst,
818 $ jch ), ilda, extra, temp )
820 CALL slartg( a( irow-iskew*jch+ioffst, jch ),
821 $ temp, c, s, dummy )
822 il = min( iendch, jch+jkl+jku ) + 2 - jch
824 CALL slarot( .true., .true.,
825 $ jch+jkl+jku.LE.iendch, il, c, s,
826 $ a( irow-iskew*jch+ioffst, jch ),
827 $ ilda, temp, extra )
846 IF( ipack.GE.5 )
THEN
852 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffg, 1 ), ilda+1 )
856 irow = max( 1, jc-k )
857 il = min( jc+1, k+2 )
859 temp = a( jc-iskew*( jc+1 )+ioffg, jc+1 )
860 angle = twopi*slarnd( 1, iseed )
863 CALL slarot( .false., jc.GT.k, .true., il, c, s,
864 $ a( irow-iskew*jc+ioffg, jc ), ilda,
866 CALL slarot( .true., .true., .false.,
867 $ min( k, n-jc )+1, c, s,
868 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
874 DO 150 jch = jc - k, 1, -k
875 CALL slartg( a( jch+1-iskew*( icol+1 )+ioffg,
876 $ icol+1 ), extra, c, s, dummy )
877 temp = a( jch-iskew*( jch+1 )+ioffg, jch+1 )
878 CALL slarot( .true., .true., .true., k+2, c,
880 $ a( ( 1-iskew )*jch+ioffg, jch ),
881 $ ilda, temp, extra )
882 irow = max( 1, jch-k )
883 il = min( jch+1, k+2 )
885 CALL slarot( .false., jch.GT.k, .true., il,
887 $ -s, a( irow-iskew*jch+ioffg, jch ),
888 $ ilda, extra, temp )
897 IF( ipack.NE.ipackg .AND. ipack.NE.3 )
THEN
899 irow = ioffst - iskew*jc
900 DO 180 jr = jc, min( n, jc+uub )
901 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
904 IF( ipack.EQ.5 )
THEN
905 DO 210 jc = n - uub + 1, n
906 DO 200 jr = n + 2 - jc, uub + 1
911 IF( ipackg.EQ.6 )
THEN
921 IF( ipack.GE.5 )
THEN
928 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffg, 1 ), ilda+1 )
931 DO 230 jc = n - 1, 1, -1
932 il = min( n+1-jc, k+2 )
934 temp = a( 1+( 1-iskew )*jc+ioffg, jc )
935 angle = twopi*slarnd( 1, iseed )
938 CALL slarot( .false., .true., n-jc.GT.k, il, c,
940 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
942 icol = max( 1, jc-k+1 )
943 CALL slarot( .true., .false., .true., jc+2-icol,
945 $ s, a( jc-iskew*icol+ioffg, icol ),
946 $ ilda, dummy, temp )
951 DO 220 jch = jc + k, n - 1, k
952 CALL slartg( a( jch-iskew*icol+ioffg, icol ),
953 $ extra, c, s, dummy )
954 temp = a( 1+( 1-iskew )*jch+ioffg, jch )
955 CALL slarot( .true., .true., .true., k+2, c,
957 $ a( jch-iskew*icol+ioffg, icol ),
958 $ ilda, extra, temp )
959 il = min( n+1-jch, k+2 )
961 CALL slarot( .false., .true., n-jch.GT.k, il,
963 $ s, a( ( 1-iskew )*jch+ioffg, jch ),
964 $ ilda, temp, extra )
973 IF( ipack.NE.ipackg .AND. ipack.NE.4 )
THEN
975 irow = ioffst - iskew*jc
976 DO 250 jr = jc, max( 1, jc-uub ), -1
977 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
980 IF( ipack.EQ.6 )
THEN
982 DO 270 jr = 1, uub + 1 - jc
987 IF( ipackg.EQ.5 )
THEN
1005 IF( isym.EQ.1 )
THEN
1009 CALL slagge( mr, nc, llb, uub, d, a, lda, iseed, work,
1015 CALL slagsy( m, llb, d, a, lda, iseed, work, iinfo )
1018 IF( iinfo.NE.0 )
THEN
1026 IF( ipack.NE.ipackg )
THEN
1027 IF( ipack.EQ.1 )
THEN
1037 ELSE IF( ipack.EQ.2 )
THEN
1047 ELSE IF( ipack.EQ.3 )
THEN
1056 IF( irow.GT.lda )
THEN
1060 a( irow, icol ) = a( i, j )
1064 ELSE IF( ipack.EQ.4 )
THEN
1073 IF( irow.GT.lda )
THEN
1077 a( irow, icol ) = a( i, j )
1081 ELSE IF( ipack.GE.5 )
THEN
1093 DO 370 i = min( j+llb, m ), 1, -1
1094 a( i-j+uub+1, j ) = a( i, j )
1098 DO 400 j = uub + 2, n
1099 DO 390 i = j - uub, min( j+llb, m )
1100 a( i-j+uub+1, j ) = a( i, j )
1110 IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1112 DO 410 jr = irow + 1, lda
1118 ELSE IF( ipack.GE.5 )
THEN
1129 DO 430 jr = 1, uub + 1 - jc
1132 DO 440 jr = max( 1, min( ir1, ir2-jc ) ), lda