123 SUBROUTINE slattp( IMAT, UPLO, TRANS, DIAG, ISEED, N, A, B, WORK,
131 CHARACTER DIAG, TRANS, UPLO
132 INTEGER IMAT, INFO, N
136 REAL A( * ), B( * ), WORK( * )
143 parameter( one = 1.0e+0, two = 2.0e+0, zero = 0.0e+0 )
147 CHARACTER DIST, PACKIT, TYPE
149 INTEGER I, IY, J, JC, JCNEXT, JCOUNT, JJ, JL, JR, JX,
151 REAL ANORM, BIGNUM, BNORM, BSCAL, C, CNDNUM, PLUS1,
152 $ plus2, ra, rb, rexp, s, sfac, smlnum, star1,
153 $ stemp, t, texp, tleft, tscal, ulp, unfl, x, y,
160 EXTERNAL lsame, isamax, slamch, slarnd
166 INTRINSIC abs, max, real, sign, sqrt
170 path( 1: 1 ) =
'Single precision'
172 unfl = slamch(
'Safe minimum' )
173 ulp = slamch(
'Epsilon' )*slamch(
'Base' )
175 bignum = ( one-ulp ) / smlnum
176 IF( ( imat.GE.7 .AND. imat.LE.10 ) .OR. imat.EQ.18 )
THEN
190 upper = lsame( uplo,
'U' )
192 CALL slatb4( path, imat, n, n,
TYPE, kl, ku, anorm, mode,
196 CALL slatb4( path, -imat, n, n,
TYPE, kl, ku, anorm, mode,
204 CALL slatms( n, n, dist, iseed,
TYPE, b, mode, cndnum, anorm,
205 $ kl, ku, packit, a, n, work, info )
212 ELSE IF( imat.EQ.7 )
THEN
239 ELSE IF( imat.LE.10 )
THEN
322 plus2 = star1 / plus1
328 plus1 = star1 / plus2
329 rexp = slarnd( 2, iseed )
330 star1 = star1*( sfac**rexp )
331 IF( rexp.LT.zero )
THEN
332 star1 = -sfac**( one-rexp )
334 star1 = sfac**( one+rexp )
339 x = sqrt( cndnum ) - one / sqrt( cndnum )
341 y = sqrt( two / real( n-2 ) )*x
356 $ a( jc+j-1 ) = work( j-2 )
358 $ a( jc+j-2 ) = work( n+j-3 )
377 a( jc+1 ) = work( j-1 )
379 $ a( jc+2 ) = work( n+j-1 )
393 CALL srotg( ra, rb, c, s )
400 stemp = c*a( jx+j ) + s*a( jx+j+1 )
401 a( jx+j+1 ) = -s*a( jx+j ) + c*a( jx+j+1 )
410 $
CALL srot( j-1, a( jcnext ), 1, a( jc ), 1, -c, -s )
414 a( jcnext+j-1 ) = -a( jcnext+j-1 )
420 jcnext = jc + n - j + 1
423 CALL srotg( ra, rb, c, s )
428 $
CALL srot( n-j-1, a( jcnext+1 ), 1, a( jc+2 ), 1, c,
436 stemp = -c*a( jx+j-i ) + s*a( jx+j-i+1 )
437 a( jx+j-i+1 ) = -s*a( jx+j-i ) - c*a( jx+j-i+1 )
445 a( jc+1 ) = -a( jc+1 )
454 ELSE IF( imat.EQ.11 )
THEN
463 CALL slarnv( 2, iseed, j, a( jc ) )
464 a( jc+j-1 ) = sign( two, a( jc+j-1 ) )
470 CALL slarnv( 2, iseed, n-j+1, a( jc ) )
471 a( jc ) = sign( two, a( jc ) )
478 CALL slarnv( 2, iseed, n, b )
479 iy = isamax( n, b, 1 )
480 bnorm = abs( b( iy ) )
481 bscal = bignum / max( one, bnorm )
482 CALL sscal( n, bscal, b, 1 )
484 ELSE IF( imat.EQ.12 )
THEN
490 CALL slarnv( 2, iseed, n, b )
491 tscal = one / max( one, real( n-1 ) )
495 CALL slarnv( 2, iseed, j-1, a( jc ) )
496 CALL sscal( j-1, tscal, a( jc ), 1 )
497 a( jc+j-1 ) = sign( one, slarnd( 2, iseed ) )
500 a( n*( n+1 ) / 2 ) = smlnum
504 CALL slarnv( 2, iseed, n-j, a( jc+1 ) )
505 CALL sscal( n-j, tscal, a( jc+1 ), 1 )
506 a( jc ) = sign( one, slarnd( 2, iseed ) )
512 ELSE IF( imat.EQ.13 )
THEN
518 CALL slarnv( 2, iseed, n, b )
522 CALL slarnv( 2, iseed, j-1, a( jc ) )
523 a( jc+j-1 ) = sign( one, slarnd( 2, iseed ) )
526 a( n*( n+1 ) / 2 ) = smlnum
530 CALL slarnv( 2, iseed, n-j, a( jc+1 ) )
531 a( jc ) = sign( one, slarnd( 2, iseed ) )
537 ELSE IF( imat.EQ.14 )
THEN
545 jc = ( n-1 )*n / 2 + 1
550 IF( jcount.LE.2 )
THEN
567 IF( jcount.LE.2 )
THEN
589 DO 290 i = 1, n - 1, 2
595 ELSE IF( imat.EQ.15 )
THEN
601 texp = one / max( one, real( n-1 ) )
603 CALL slarnv( 2, iseed, n, b )
630 ELSE IF( imat.EQ.16 )
THEN
638 CALL slarnv( 2, iseed, j, a( jc ) )
640 a( jc+j-1 ) = sign( two, a( jc+j-1 ) )
649 CALL slarnv( 2, iseed, n-j+1, a( jc ) )
651 a( jc ) = sign( two, a( jc ) )
658 CALL slarnv( 2, iseed, n, b )
659 CALL sscal( n, two, b, 1 )
661 ELSE IF( imat.EQ.17 )
THEN
669 tscal = ( one-ulp ) / tscal
670 DO 360 j = 1, n*( n+1 ) / 2
675 jc = ( n-1 )*n / 2 + 1
677 a( jc ) = -tscal / real( n+1 )
679 b( j ) = texp*( one-ulp )
681 a( jc ) = -( tscal / real( n+1 ) ) / real( n+2 )
683 b( j-1 ) = texp*real( n*n+n-1 )
687 b( 1 ) = ( real( n+1 ) / real( n+2 ) )*tscal
690 DO 380 j = 1, n - 1, 2
691 a( jc+n-j ) = -tscal / real( n+1 )
693 b( j ) = texp*( one-ulp )
695 a( jc+n-j-1 ) = -( tscal / real( n+1 ) ) / real( n+2 )
697 b( j+1 ) = texp*real( n*n+n-1 )
701 b( n ) = ( real( n+1 ) / real( n+2 ) )*tscal
704 ELSE IF( imat.EQ.18 )
THEN
713 CALL slarnv( 2, iseed, j-1, a( jc ) )
721 $
CALL slarnv( 2, iseed, n-j, a( jc+1 ) )
729 CALL slarnv( 2, iseed, n, b )
730 iy = isamax( n, b, 1 )
731 bnorm = abs( b( iy ) )
732 bscal = bignum / max( one, bnorm )
733 CALL sscal( n, bscal, b, 1 )
735 ELSE IF( imat.EQ.19 )
THEN
741 tleft = bignum / max( one, real( n-1 ) )
742 tscal = bignum*( real( n-1 ) / max( one, real( n ) ) )
746 CALL slarnv( 2, iseed, j, a( jc ) )
748 a( jc+i-1 ) = sign( tleft, a( jc+i-1 ) ) +
756 CALL slarnv( 2, iseed, n-j+1, a( jc ) )
758 a( jc+i-j ) = sign( tleft, a( jc+i-j ) ) +
764 CALL slarnv( 2, iseed, n, b )
765 CALL sscal( n, two, b, 1 )
771 IF( .NOT.lsame( trans,
'N' ) )
THEN
779 a( jr-i+j ) = a( jl )
793 a( jl+i-j ) = a( jr )
subroutine slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine srot(n, sx, incx, sy, incy, c, s)
SROT
subroutine srotg(a, b, c, s)
SROTG
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine slatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
SLATB4
subroutine slatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
SLATMS
subroutine slattp(imat, uplo, trans, diag, iseed, n, a, b, work, info)
SLATTP