329 SUBROUTINE slatmt( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
330 $ RANK, KL, KU, PACK, A, LDA, WORK, INFO )
338 INTEGER INFO, KL, KU, LDA, M, MODE, N, RANK
339 CHARACTER DIST, PACK, SYM
342 REAL A( LDA, * ), D( * ), WORK( * )
350 parameter( zero = 0.0e0 )
352 parameter( one = 1.0e0 )
354 parameter( twopi = 6.28318530717958647692528676655900576839e+0 )
357 REAL ALPHA, ANGLE, C, DUMMY, EXTRA, S, TEMP
358 INTEGER I, IC, ICOL, IDIST, IENDCH, IINFO, IL, ILDA,
359 $ ioffg, ioffst, ipack, ipackg, ir, ir1, ir2,
360 $ irow, irsign, iskew, isym, isympk, j, jc, jch,
361 $ jkl, jku, jr, k, llb, minlda, mnmin, mr, nc,
363 LOGICAL GIVENS, ILEXTR, ILTEMP, TOPDWN
368 EXTERNAL slarnd, lsame
375 INTRINSIC abs, cos, max, min, mod, real, sin
386 IF( m.EQ.0 .OR. n.EQ.0 )
391 IF( lsame( dist,
'U' ) )
THEN
393 ELSE IF( lsame( dist,
'S' ) )
THEN
395 ELSE IF( lsame( dist,
'N' ) )
THEN
403 IF( lsame( sym,
'N' ) )
THEN
406 ELSE IF( lsame( sym,
'P' ) )
THEN
409 ELSE IF( lsame( sym,
'S' ) )
THEN
412 ELSE IF( lsame( sym,
'H' ) )
THEN
422 IF( lsame( pack,
'N' ) )
THEN
424 ELSE IF( lsame( pack,
'U' ) )
THEN
427 ELSE IF( lsame( pack,
'L' ) )
THEN
430 ELSE IF( lsame( pack,
'C' ) )
THEN
433 ELSE IF( lsame( pack,
'R' ) )
THEN
436 ELSE IF( lsame( pack,
'B' ) )
THEN
439 ELSE IF( lsame( pack,
'Q' ) )
THEN
442 ELSE IF( lsame( pack,
'Z' ) )
THEN
456 IF( ipack.EQ.5 .OR. ipack.EQ.6 )
THEN
458 ELSE IF( ipack.EQ.7 )
THEN
459 minlda = llb + uub + 1
469 IF( real( llb+uub ).LT.0.3*real( max( 1, mr+nc ) ) )
475 IF( lda.LT.m .AND. lda.GE.minlda )
482 ELSE IF( m.NE.n .AND. isym.NE.1 )
THEN
484 ELSE IF( n.LT.0 )
THEN
486 ELSE IF( idist.EQ.-1 )
THEN
488 ELSE IF( isym.EQ.-1 )
THEN
490 ELSE IF( abs( mode ).GT.6 )
THEN
492 ELSE IF( ( mode.NE.0 .AND. abs( mode ).NE.6 ) .AND. cond.LT.one )
495 ELSE IF( kl.LT.0 )
THEN
497 ELSE IF( ku.LT.0 .OR. ( isym.NE.1 .AND. kl.NE.ku ) )
THEN
499 ELSE IF( ipack.EQ.-1 .OR. ( isympk.EQ.1 .AND. isym.EQ.1 ) .OR.
500 $ ( isympk.EQ.2 .AND. isym.EQ.1 .AND. kl.GT.0 ) .OR.
501 $ ( isympk.EQ.3 .AND. isym.EQ.1 .AND. ku.GT.0 ) .OR.
502 $ ( isympk.NE.0 .AND. m.NE.n ) )
THEN
504 ELSE IF( lda.LT.max( 1, minlda ) )
THEN
509 CALL xerbla(
'SLATMT', -info )
516 iseed( i ) = mod( abs( iseed( i ) ), 4096 )
519 IF( mod( iseed( 4 ), 2 ).NE.1 )
520 $ iseed( 4 ) = iseed( 4 ) + 1
526 CALL slatm7( mode, cond, irsign, idist, iseed, d, mnmin, rank,
528 IF( iinfo.NE.0 )
THEN
536 IF( abs( d( 1 ) ).LE.abs( d( rank ) ) )
THEN
542 IF( mode.NE.0 .AND. abs( mode ).NE.6 )
THEN
548 temp = max( temp, abs( d( i ) ) )
551 IF( temp.GT.zero )
THEN
558 CALL sscal( rank, alpha, d, 1 )
571 IF( ipack.GT.4 )
THEN
574 IF( ipack.GT.5 )
THEN
590 CALL slaset(
'Full', lda, n, zero, zero, a, lda )
595 IF( llb.EQ.0 .AND. uub.EQ.0 )
THEN
596 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffst, 1 ), ilda+1 )
597 IF( ipack.LE.2 .OR. ipack.GE.5 )
600 ELSE IF( givens )
THEN
609 IF( ipack.GT.4 )
THEN
615 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffst, 1 ), ilda+1 )
626 DO 130 jr = 1, min( m+jku, n ) + jkl - 1
628 angle = twopi*slarnd( 1, iseed )
631 icol = max( 1, jr-jkl )
633 il = min( n, jr+jku ) + 1 - icol
634 CALL slarot( .true., jr.GT.jkl, .false., il,
636 $ s, a( jr-iskew*icol+ioffst, icol ),
637 $ ilda, extra, dummy )
644 DO 120 jch = jr - jkl, 1, -jkl - jku
646 CALL slartg( a( ir+1-iskew*( ic+1 )+ioffst,
647 $ ic+1 ), extra, c, s, dummy )
649 irow = max( 1, jch-jku )
653 CALL slarot( .false., iltemp, .true., il, c,
655 $ a( irow-iskew*ic+ioffst, ic ),
656 $ ilda, temp, extra )
658 CALL slartg( a( irow+1-iskew*( ic+1 )+ioffst,
659 $ ic+1 ), temp, c, s, dummy )
660 icol = max( 1, jch-jku-jkl )
663 CALL slarot( .true., jch.GT.jku+jkl,
665 $ il, c, -s, a( irow-iskew*icol+
666 $ ioffst, icol ), ilda, extra,
680 DO 160 jc = 1, min( n+jkl, m ) + jku - 1
682 angle = twopi*slarnd( 1, iseed )
685 irow = max( 1, jc-jku )
687 il = min( m, jc+jkl ) + 1 - irow
688 CALL slarot( .false., jc.GT.jku, .false., il,
690 $ s, a( irow-iskew*jc+ioffst, jc ),
691 $ ilda, extra, dummy )
698 DO 150 jch = jc - jku, 1, -jkl - jku
700 CALL slartg( a( ir+1-iskew*( ic+1 )+ioffst,
701 $ ic+1 ), extra, c, s, dummy )
703 icol = max( 1, jch-jkl )
707 CALL slarot( .true., iltemp, .true., il, c,
709 $ a( ir-iskew*icol+ioffst, icol ),
710 $ ilda, temp, extra )
712 CALL slartg( a( ir+1-iskew*( icol+1 )+ioffst,
713 $ icol+1 ), temp, c, s, dummy )
714 irow = max( 1, jch-jkl-jku )
717 CALL slarot( .false., jch.GT.jkl+jku,
719 $ il, c, -s, a( irow-iskew*icol+
720 $ ioffst, icol ), ilda, extra,
741 iendch = min( m, n+jkl ) - 1
742 DO 190 jc = min( m+jku, n ) - 1, 1 - jkl, -1
744 angle = twopi*slarnd( 1, iseed )
747 irow = max( 1, jc-jku+1 )
749 il = min( m, jc+jkl+1 ) + 1 - irow
750 CALL slarot( .false., .false., jc+jkl.LT.m,
752 $ c, s, a( irow-iskew*jc+ioffst,
753 $ jc ), ilda, dummy, extra )
759 DO 180 jch = jc + jkl, iendch, jkl + jku
762 CALL slartg( a( jch-iskew*ic+ioffst, ic ),
763 $ extra, c, s, dummy )
766 icol = min( n-1, jch+jku )
767 iltemp = jch + jku.LT.n
769 CALL slarot( .true., ilextr, iltemp,
771 $ c, s, a( jch-iskew*ic+ioffst, ic ),
772 $ ilda, extra, temp )
774 CALL slartg( a( jch-iskew*icol+ioffst,
775 $ icol ), temp, c, s, dummy )
776 il = min( iendch, jch+jkl+jku ) + 2 - jch
778 CALL slarot( .false., .true.,
779 $ jch+jkl+jku.LE.iendch, il, c, s,
780 $ a( jch-iskew*icol+ioffst,
781 $ icol ), ilda, temp, extra )
796 iendch = min( n, m+jku ) - 1
797 DO 220 jr = min( n+jkl, m ) - 1, 1 - jku, -1
799 angle = twopi*slarnd( 1, iseed )
802 icol = max( 1, jr-jkl+1 )
804 il = min( n, jr+jku+1 ) + 1 - icol
805 CALL slarot( .true., .false., jr+jku.LT.n,
807 $ c, s, a( jr-iskew*icol+ioffst,
808 $ icol ), ilda, dummy, extra )
814 DO 210 jch = jr + jku, iendch, jkl + jku
817 CALL slartg( a( ir-iskew*jch+ioffst, jch ),
818 $ extra, c, s, dummy )
821 irow = min( m-1, jch+jkl )
822 iltemp = jch + jkl.LT.m
824 CALL slarot( .false., ilextr, iltemp,
826 $ c, s, a( ir-iskew*jch+ioffst,
827 $ jch ), ilda, extra, temp )
829 CALL slartg( a( irow-iskew*jch+ioffst, jch ),
830 $ temp, c, s, dummy )
831 il = min( iendch, jch+jkl+jku ) + 2 - jch
833 CALL slarot( .true., .true.,
834 $ jch+jkl+jku.LE.iendch, il, c, s,
835 $ a( irow-iskew*jch+ioffst, jch ),
836 $ ilda, temp, extra )
855 IF( ipack.GE.5 )
THEN
861 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffg, 1 ), ilda+1 )
865 irow = max( 1, jc-k )
866 il = min( jc+1, k+2 )
868 temp = a( jc-iskew*( jc+1 )+ioffg, jc+1 )
869 angle = twopi*slarnd( 1, iseed )
872 CALL slarot( .false., jc.GT.k, .true., il, c, s,
873 $ a( irow-iskew*jc+ioffg, jc ), ilda,
875 CALL slarot( .true., .true., .false.,
876 $ min( k, n-jc )+1, c, s,
877 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
883 DO 240 jch = jc - k, 1, -k
884 CALL slartg( a( jch+1-iskew*( icol+1 )+ioffg,
885 $ icol+1 ), extra, c, s, dummy )
886 temp = a( jch-iskew*( jch+1 )+ioffg, jch+1 )
887 CALL slarot( .true., .true., .true., k+2, c,
889 $ a( ( 1-iskew )*jch+ioffg, jch ),
890 $ ilda, temp, extra )
891 irow = max( 1, jch-k )
892 il = min( jch+1, k+2 )
894 CALL slarot( .false., jch.GT.k, .true., il,
896 $ -s, a( irow-iskew*jch+ioffg, jch ),
897 $ ilda, extra, temp )
906 IF( ipack.NE.ipackg .AND. ipack.NE.3 )
THEN
908 irow = ioffst - iskew*jc
909 DO 270 jr = jc, min( n, jc+uub )
910 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
913 IF( ipack.EQ.5 )
THEN
914 DO 300 jc = n - uub + 1, n
915 DO 290 jr = n + 2 - jc, uub + 1
920 IF( ipackg.EQ.6 )
THEN
930 IF( ipack.GE.5 )
THEN
937 CALL scopy( mnmin, d, 1, a( 1-iskew+ioffg, 1 ), ilda+1 )
940 DO 320 jc = n - 1, 1, -1
941 il = min( n+1-jc, k+2 )
943 temp = a( 1+( 1-iskew )*jc+ioffg, jc )
944 angle = twopi*slarnd( 1, iseed )
947 CALL slarot( .false., .true., n-jc.GT.k, il, c,
949 $ a( ( 1-iskew )*jc+ioffg, jc ), ilda,
951 icol = max( 1, jc-k+1 )
952 CALL slarot( .true., .false., .true., jc+2-icol,
954 $ s, a( jc-iskew*icol+ioffg, icol ),
955 $ ilda, dummy, temp )
960 DO 310 jch = jc + k, n - 1, k
961 CALL slartg( a( jch-iskew*icol+ioffg, icol ),
962 $ extra, c, s, dummy )
963 temp = a( 1+( 1-iskew )*jch+ioffg, jch )
964 CALL slarot( .true., .true., .true., k+2, c,
966 $ a( jch-iskew*icol+ioffg, icol ),
967 $ ilda, extra, temp )
968 il = min( n+1-jch, k+2 )
970 CALL slarot( .false., .true., n-jch.GT.k, il,
972 $ s, a( ( 1-iskew )*jch+ioffg, jch ),
973 $ ilda, temp, extra )
982 IF( ipack.NE.ipackg .AND. ipack.NE.4 )
THEN
984 irow = ioffst - iskew*jc
985 DO 340 jr = jc, max( 1, jc-uub ), -1
986 a( jr+irow, jc ) = a( jc-iskew*jr+ioffg, jr )
989 IF( ipack.EQ.6 )
THEN
991 DO 360 jr = 1, uub + 1 - jc
996 IF( ipackg.EQ.5 )
THEN
1014 IF( isym.EQ.1 )
THEN
1018 CALL slagge( mr, nc, llb, uub, d, a, lda, iseed, work,
1024 CALL slagsy( m, llb, d, a, lda, iseed, work, iinfo )
1027 IF( iinfo.NE.0 )
THEN
1035 IF( ipack.NE.ipackg )
THEN
1036 IF( ipack.EQ.1 )
THEN
1046 ELSE IF( ipack.EQ.2 )
THEN
1056 ELSE IF( ipack.EQ.3 )
THEN
1065 IF( irow.GT.lda )
THEN
1069 a( irow, icol ) = a( i, j )
1073 ELSE IF( ipack.EQ.4 )
THEN
1082 IF( irow.GT.lda )
THEN
1086 a( irow, icol ) = a( i, j )
1090 ELSE IF( ipack.GE.5 )
THEN
1102 DO 460 i = min( j+llb, m ), 1, -1
1103 a( i-j+uub+1, j ) = a( i, j )
1107 DO 490 j = uub + 2, n
1108 DO 480 i = j - uub, min( j+llb, m )
1109 a( i-j+uub+1, j ) = a( i, j )
1119 IF( ipack.EQ.3 .OR. ipack.EQ.4 )
THEN
1121 DO 500 jr = irow + 1, lda
1127 ELSE IF( ipack.GE.5 )
THEN
1138 DO 520 jr = 1, uub + 1 - jc
1141 DO 530 jr = max( 1, min( ir1, ir2-jc ) ), lda