131 SUBROUTINE dlattr( IMAT, UPLO, TRANS, DIAG, ISEED, N, A, LDA, B,
139 CHARACTER DIAG, TRANS, UPLO
140 INTEGER IMAT, INFO, LDA, N
144 DOUBLE PRECISION A( LDA, * ), B( * ), WORK( * )
150 DOUBLE PRECISION ONE, TWO, ZERO
151 parameter( one = 1.0d+0, two = 2.0d+0, zero = 0.0d+0 )
157 INTEGER I, IY, J, JCOUNT, KL, KU, MODE
158 DOUBLE PRECISION 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
165 DOUBLE PRECISION DLAMCH, DLARND
166 EXTERNAL lsame, idamax, dlamch, dlarnd
173 INTRINSIC abs, dble, max, sign, sqrt
177 path( 1: 1 ) =
'Double precision'
179 unfl = dlamch(
'Safe minimum' )
180 ulp = dlamch(
'Epsilon' )*dlamch(
'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 dlatb4( path, imat, n, n,
TYPE, kl, ku, anorm, mode,
202 CALL dlatb4( path, -imat, n, n,
TYPE, kl, ku, anorm, mode,
209 CALL dlatms( 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 = dlarnd( 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.d0 / ( n-2 ) )*x
346 CALL dcopy( n-3, work, 1, a( 2, 3 ), lda+1 )
348 $
CALL dcopy( n-4, work( n+1 ), 1, a( 2, 4 ), lda+1 )
357 CALL dcopy( n-3, work, 1, a( 3, 2 ), lda+1 )
359 $
CALL dcopy( n-4, work( n+1 ), 1, a( 4, 2 ), lda+1 )
374 CALL drotg( ra, rb, c, s )
379 $
CALL drot( n-j-1, a( j, j+2 ), lda, a( j+1, j+2 ),
385 $
CALL drot( j-1, a( 1, j+1 ), 1, a( 1, j ), 1, -c, -s )
389 a( j, j+1 ) = -a( j, j+1 )
395 CALL drotg( ra, rb, c, s )
400 $
CALL drot( n-j-1, a( j+2, j+1 ), 1, a( j+2, j ), 1, c,
406 $
CALL drot( 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 dlarnv( 2, iseed, j, a( 1, j ) )
428 a( j, j ) = sign( two, a( j, j ) )
432 CALL dlarnv( 2, iseed, n-j+1, a( j, j ) )
433 a( j, j ) = sign( two, a( j, j ) )
439 CALL dlarnv( 2, iseed, n, b )
440 iy = idamax( n, b, 1 )
441 bnorm = abs( b( iy ) )
442 bscal = bignum / max( one, bnorm )
443 CALL dscal( n, bscal, b, 1 )
445 ELSE IF( imat.EQ.12 )
THEN
451 CALL dlarnv( 2, iseed, n, b )
452 tscal = one / max( one, dble( n-1 ) )
455 CALL dlarnv( 2, iseed, j, a( 1, j ) )
456 CALL dscal( 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 dlarnv( 2, iseed, n-j+1, a( j, j ) )
464 $
CALL dscal( 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 dlarnv( 2, iseed, n, b )
479 CALL dlarnv( 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 dlarnv( 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, dble( n-1 ) )
553 CALL dlarnv( 2, iseed, n, b )
576 ELSE IF( imat.EQ.16 )
THEN
583 CALL dlarnv( 2, iseed, j, a( 1, j ) )
585 a( j, j ) = sign( two, a( j, j ) )
592 CALL dlarnv( 2, iseed, n-j+1, a( j, j ) )
594 a( j, j ) = sign( two, a( j, j ) )
600 CALL dlarnv( 2, iseed, n, b )
601 CALL dscal( n, two, b, 1 )
603 ELSE IF( imat.EQ.17 )
THEN
611 tscal = ( one-ulp ) / tscal
620 a( 1, j ) = -tscal / dble( n+1 )
622 b( j ) = texp*( one-ulp )
623 a( 1, j-1 ) = -( tscal / dble( n+1 ) ) / dble( n+2 )
625 b( j-1 ) = texp*dble( n*n+n-1 )
628 b( 1 ) = ( dble( n+1 ) / dble( n+2 ) )*tscal
630 DO 350 j = 1, n - 1, 2
631 a( n, j ) = -tscal / dble( n+1 )
633 b( j ) = texp*( one-ulp )
634 a( n, j+1 ) = -( tscal / dble( n+1 ) ) / dble( n+2 )
636 b( j+1 ) = texp*dble( n*n+n-1 )
639 b( n ) = ( dble( n+1 ) / dble( n+2 ) )*tscal
642 ELSE IF( imat.EQ.18 )
THEN
650 CALL dlarnv( 2, iseed, j-1, a( 1, j ) )
656 $
CALL dlarnv( 2, iseed, n-j, a( j+1, j ) )
663 CALL dlarnv( 2, iseed, n, b )
664 iy = idamax( n, b, 1 )
665 bnorm = abs( b( iy ) )
666 bscal = bignum / max( one, bnorm )
667 CALL dscal( n, bscal, b, 1 )
669 ELSE IF( imat.EQ.19 )
THEN
676 tleft = bignum / max( one, dble( n-1 ) )
677 tscal = bignum*( dble( n-1 ) / max( one, dble( n ) ) )
680 CALL dlarnv( 2, iseed, j, a( 1, j ) )
682 a( i, j ) = sign( tleft, a( i, j ) ) + tscal*a( i, j )
687 CALL dlarnv( 2, iseed, n-j+1, a( j, j ) )
689 a( i, j ) = sign( tleft, a( i, j ) ) + tscal*a( i, j )
693 CALL dlarnv( 2, iseed, n, b )
694 CALL dscal( n, two, b, 1 )
699 IF( .NOT.lsame( trans,
'N' ) )
THEN
702 CALL dswap( n-2*j+1, a( j, j ), lda, a( j+1, n-j+1 ),
707 CALL dswap( n-2*j+1, a( j, j ), 1, a( n-j+1, j+1 ),
subroutine dlatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
DLATB4
subroutine dlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
DLATMS
subroutine dlattr(imat, uplo, trans, diag, iseed, n, a, lda, b, work, info)
DLATTR
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dlarnv(idist, iseed, n, x)
DLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine drot(n, dx, incx, dy, incy, c, s)
DROT
subroutine drotg(a, b, c, s)
DROTG
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dswap(n, dx, incx, dy, incy)
DSWAP