131 SUBROUTINE slattr( IMAT, UPLO, TRANS, DIAG, ISEED, N, A, LDA, B,
139 CHARACTER DIAG, TRANS, UPLO
140 INTEGER IMAT, INFO, LDA, N
144 REAL A( LDA, * ), B( * ), WORK( * )
151 parameter( one = 1.0e+0, two = 2.0e+0, zero = 0.0e+0 )
157 INTEGER I, IY, J, JCOUNT, KL, KU, MODE
158 REAL ANORM, BIGNUM, BNORM, BSCAL, C, CNDNUM, PLUS1,
159 $ plus2, ra, rb, rexp, s, sfac, smlnum, star1,
160 $ texp, tleft, tscal, ulp, unfl, x, y, z
166 EXTERNAL lsame, isamax, slamch, slarnd
173 INTRINSIC abs, max, real, sign, sqrt
177 path( 1: 1 ) =
'Single precision'
179 unfl = slamch(
'Safe minimum' )
180 ulp = slamch(
'Epsilon' )*slamch(
'Base' )
182 bignum = ( one-ulp ) / smlnum
183 IF( ( imat.GE.7 .AND. imat.LE.10 ) .OR. imat.EQ.18 )
THEN
197 upper = lsame( uplo,
'U' )
199 CALL slatb4( path, imat, n, n,
TYPE, kl, ku, anorm, mode,
202 CALL slatb4( path, -imat, n, n,
TYPE, kl, ku, anorm, mode,
209 CALL slatms( n, n, dist, iseed,
TYPE, b, mode, cndnum, anorm,
210 $ kl, ku,
'No packing', a, lda, work, info )
217 ELSE IF( imat.EQ.7 )
THEN
240 ELSE IF( imat.LE.10 )
THEN
319 plus2 = star1 / plus1
325 plus1 = star1 / plus2
326 rexp = slarnd( 2, iseed )
327 star1 = star1*( sfac**rexp )
328 IF( rexp.LT.zero )
THEN
329 star1 = -sfac**( one-rexp )
331 star1 = sfac**( one+rexp )
336 x = sqrt( cndnum ) - 1 / sqrt( cndnum )
338 y = sqrt( 2. / ( n-2 ) )*x
346 CALL scopy( n-3, work, 1, a( 2, 3 ), lda+1 )
348 $
CALL scopy( n-4, work( n+1 ), 1, a( 2, 4 ), lda+1 )
357 CALL scopy( n-3, work, 1, a( 3, 2 ), lda+1 )
359 $
CALL scopy( n-4, work( n+1 ), 1, a( 4, 2 ), lda+1 )
374 CALL srotg( ra, rb, c, s )
379 $
CALL srot( n-j-1, a( j, j+2 ), lda, a( j+1, j+2 ),
385 $
CALL srot( j-1, a( 1, j+1 ), 1, a( 1, j ), 1, -c, -s )
389 a( j, j+1 ) = -a( j, j+1 )
395 CALL srotg( ra, rb, c, s )
400 $
CALL srot( n-j-1, a( j+2, j+1 ), 1, a( j+2, j ), 1, c,
406 $
CALL srot( j-1, a( j, 1 ), lda, a( j+1, 1 ), lda, -c,
411 a( j+1, j ) = -a( j+1, j )
419 ELSE IF( imat.EQ.11 )
THEN
427 CALL slarnv( 2, iseed, j, a( 1, j ) )
428 a( j, j ) = sign( two, a( j, j ) )
432 CALL slarnv( 2, iseed, n-j+1, a( j, j ) )
433 a( j, j ) = sign( two, a( j, j ) )
439 CALL slarnv( 2, iseed, n, b )
440 iy = isamax( n, b, 1 )
441 bnorm = abs( b( iy ) )
442 bscal = bignum / max( one, bnorm )
443 CALL sscal( n, bscal, b, 1 )
445 ELSE IF( imat.EQ.12 )
THEN
451 CALL slarnv( 2, iseed, n, b )
452 tscal = one / max( one, real( n-1 ) )
455 CALL slarnv( 2, iseed, j, a( 1, j ) )
456 CALL sscal( j-1, tscal, a( 1, j ), 1 )
457 a( j, j ) = sign( one, a( j, j ) )
459 a( n, n ) = smlnum*a( n, n )
462 CALL slarnv( 2, iseed, n-j+1, a( j, j ) )
464 $
CALL sscal( n-j, tscal, a( j+1, j ), 1 )
465 a( j, j ) = sign( one, a( j, j ) )
467 a( 1, 1 ) = smlnum*a( 1, 1 )
470 ELSE IF( imat.EQ.13 )
THEN
476 CALL slarnv( 2, iseed, n, b )
479 CALL slarnv( 2, iseed, j, a( 1, j ) )
480 a( j, j ) = sign( one, a( j, j ) )
482 a( n, n ) = smlnum*a( n, n )
485 CALL slarnv( 2, iseed, n-j+1, a( j, j ) )
486 a( j, j ) = sign( one, a( j, j ) )
488 a( 1, 1 ) = smlnum*a( 1, 1 )
491 ELSE IF( imat.EQ.14 )
THEN
503 IF( jcount.LE.2 )
THEN
518 IF( jcount.LE.2 )
THEN
539 DO 250 i = 1, n - 1, 2
545 ELSE IF( imat.EQ.15 )
THEN
551 texp = one / max( one, real( n-1 ) )
553 CALL slarnv( 2, iseed, n, b )
576 ELSE IF( imat.EQ.16 )
THEN
583 CALL slarnv( 2, iseed, j, a( 1, j ) )
585 a( j, j ) = sign( two, a( j, j ) )
592 CALL slarnv( 2, iseed, n-j+1, a( j, j ) )
594 a( j, j ) = sign( two, a( j, j ) )
600 CALL slarnv( 2, iseed, n, b )
601 CALL sscal( n, two, b, 1 )
603 ELSE IF( imat.EQ.17 )
THEN
611 tscal = ( one-ulp ) / tscal
620 a( 1, j ) = -tscal / real( n+1 )
622 b( j ) = texp*( one-ulp )
623 a( 1, j-1 ) = -( tscal / real( n+1 ) ) / real( n+2 )
625 b( j-1 ) = texp*real( n*n+n-1 )
628 b( 1 ) = ( real( n+1 ) / real( n+2 ) )*tscal
630 DO 350 j = 1, n - 1, 2
631 a( n, j ) = -tscal / real( n+1 )
633 b( j ) = texp*( one-ulp )
634 a( n, j+1 ) = -( tscal / real( n+1 ) ) / real( n+2 )
636 b( j+1 ) = texp*real( n*n+n-1 )
639 b( n ) = ( real( n+1 ) / real( n+2 ) )*tscal
642 ELSE IF( imat.EQ.18 )
THEN
650 CALL slarnv( 2, iseed, j-1, a( 1, j ) )
656 $
CALL slarnv( 2, iseed, n-j, a( j+1, j ) )
663 CALL slarnv( 2, iseed, n, b )
664 iy = isamax( n, b, 1 )
665 bnorm = abs( b( iy ) )
666 bscal = bignum / max( one, bnorm )
667 CALL sscal( n, bscal, b, 1 )
669 ELSE IF( imat.EQ.19 )
THEN
676 tleft = bignum / max( one, real( n-1 ) )
677 tscal = bignum*( real( n-1 ) / max( one, real( n ) ) )
680 CALL slarnv( 2, iseed, j, a( 1, j ) )
682 a( i, j ) = sign( tleft, a( i, j ) ) + tscal*a( i, j )
687 CALL slarnv( 2, iseed, n-j+1, a( j, j ) )
689 a( i, j ) = sign( tleft, a( i, j ) ) + tscal*a( i, j )
693 CALL slarnv( 2, iseed, n, b )
694 CALL sscal( n, two, b, 1 )
699 IF( .NOT.lsame( trans,
'N' ) )
THEN
702 CALL sswap( n-2*j+1, a( j, j ), lda, a( j+1, n-j+1 ),
707 CALL sswap( n-2*j+1, a( j, j ), 1, a( n-j+1, j+1 ),
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
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 sswap(n, sx, incx, sy, incy)
SSWAP
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 slattr(imat, uplo, trans, diag, iseed, n, a, lda, b, work, info)
SLATTR