129 SUBROUTINE zlattp( IMAT, UPLO, TRANS, DIAG, ISEED, N, AP, B, WORK,
137 CHARACTER DIAG, TRANS, UPLO
138 INTEGER IMAT, INFO, N
142 DOUBLE PRECISION RWORK( * )
143 COMPLEX*16 AP( * ), B( * ), WORK( * )
149 DOUBLE PRECISION ONE, TWO, ZERO
150 parameter( one = 1.0d+0, two = 2.0d+0, zero = 0.0d+0 )
154 CHARACTER DIST, PACKIT, TYPE
156 INTEGER I, IY, J, JC, JCNEXT, JCOUNT, JJ, JL, JR, JX,
158 DOUBLE PRECISION ANORM, BIGNUM, BNORM, BSCAL, C, CNDNUM, REXP,
159 $ sfac, smlnum, t, texp, tleft, tscal, ulp, unfl,
161 COMPLEX*16 CTEMP, PLUS1, PLUS2, RA, RB, S, STAR1
166 DOUBLE PRECISION DLAMCH
168 EXTERNAL lsame, izamax, dlamch, zlarnd
175 INTRINSIC abs, dble, dcmplx, dconjg, max, sqrt
179 path( 1: 1 ) =
'Zomplex precision'
181 unfl = dlamch(
'Safe minimum' )
182 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
184 bignum = ( one-ulp ) / smlnum
185 IF( ( imat.GE.7 .AND. imat.LE.10 ) .OR. imat.EQ.18 )
THEN
199 upper = lsame( uplo,
'U' )
201 CALL zlatb4( path, imat, n, n,
TYPE, kl, ku, anorm, mode,
205 CALL zlatb4( path, -imat, n, n,
TYPE, kl, ku, anorm, mode,
213 CALL zlatms( n, n, dist, iseed,
TYPE, rwork, mode, cndnum,
214 $ anorm, kl, ku, packit, ap, n, work, info )
221 ELSE IF( imat.EQ.7 )
THEN
248 ELSE IF( imat.LE.10 )
THEN
327 star1 = 0.25d0*zlarnd( 5, iseed )
329 plus1 = sfac*zlarnd( 5, iseed )
331 plus2 = star1 / plus1
337 plus1 = star1 / plus2
338 rexp = dble( zlarnd( 2, iseed ) )
339 IF( rexp.LT.zero )
THEN
340 star1 = -sfac**( one-rexp )*zlarnd( 5, iseed )
342 star1 = sfac**( one+rexp )*zlarnd( 5, iseed )
347 x = sqrt( cndnum ) - one / sqrt( cndnum )
349 y = sqrt( two / dble( n-2 ) )*x
364 $ ap( jc+j-1 ) = work( j-2 )
366 $ ap( jc+j-2 ) = work( n+j-3 )
385 ap( jc+1 ) = work( j-1 )
387 $ ap( jc+2 ) = work( n+j-1 )
399 ra = ap( jcnext+j-1 )
401 CALL zrotg( ra, rb, c, s )
408 ctemp = c*ap( jx+j ) + s*ap( jx+j+1 )
409 ap( jx+j+1 ) = -dconjg( s )*ap( jx+j ) +
419 $
CALL zrot( j-1, ap( jcnext ), 1, ap( jc ), 1, -c, -s )
423 ap( jcnext+j-1 ) = -ap( jcnext+j-1 )
429 jcnext = jc + n - j + 1
432 CALL zrotg( ra, rb, c, s )
438 $
CALL zrot( n-j-1, ap( jcnext+1 ), 1, ap( jc+2 ), 1, c,
446 ctemp = -c*ap( jx+j-i ) + s*ap( jx+j-i+1 )
447 ap( jx+j-i+1 ) = -dconjg( s )*ap( jx+j-i ) -
456 ap( jc+1 ) = -ap( jc+1 )
465 ELSE IF( imat.EQ.11 )
THEN
474 CALL zlarnv( 4, iseed, j-1, ap( jc ) )
475 ap( jc+j-1 ) = zlarnd( 5, iseed )*two
482 $
CALL zlarnv( 4, iseed, n-j, ap( jc+1 ) )
483 ap( jc ) = zlarnd( 5, iseed )*two
490 CALL zlarnv( 2, iseed, n, b )
491 iy = izamax( n, b, 1 )
492 bnorm = abs( b( iy ) )
493 bscal = bignum / max( one, bnorm )
494 CALL zdscal( n, bscal, b, 1 )
496 ELSE IF( imat.EQ.12 )
THEN
502 CALL zlarnv( 2, iseed, n, b )
503 tscal = one / max( one, dble( n-1 ) )
507 CALL zlarnv( 4, iseed, j-1, ap( jc ) )
508 CALL zdscal( j-1, tscal, ap( jc ), 1 )
509 ap( jc+j-1 ) = zlarnd( 5, iseed )
512 ap( n*( n+1 ) / 2 ) = smlnum*ap( n*( n+1 ) / 2 )
516 CALL zlarnv( 2, iseed, n-j, ap( jc+1 ) )
517 CALL zdscal( n-j, tscal, ap( jc+1 ), 1 )
518 ap( jc ) = zlarnd( 5, iseed )
521 ap( 1 ) = smlnum*ap( 1 )
524 ELSE IF( imat.EQ.13 )
THEN
530 CALL zlarnv( 2, iseed, n, b )
534 CALL zlarnv( 4, iseed, j-1, ap( jc ) )
535 ap( jc+j-1 ) = zlarnd( 5, iseed )
538 ap( n*( n+1 ) / 2 ) = smlnum*ap( n*( n+1 ) / 2 )
542 CALL zlarnv( 4, iseed, n-j, ap( jc+1 ) )
543 ap( jc ) = zlarnd( 5, iseed )
546 ap( 1 ) = smlnum*ap( 1 )
549 ELSE IF( imat.EQ.14 )
THEN
557 jc = ( n-1 )*n / 2 + 1
562 IF( jcount.LE.2 )
THEN
563 ap( jc+j-1 ) = smlnum*zlarnd( 5, iseed )
565 ap( jc+j-1 ) = zlarnd( 5, iseed )
579 IF( jcount.LE.2 )
THEN
580 ap( jc ) = smlnum*zlarnd( 5, iseed )
582 ap( jc ) = zlarnd( 5, iseed )
597 b( i-1 ) = smlnum*zlarnd( 5, iseed )
601 DO 290 i = 1, n - 1, 2
603 b( i+1 ) = smlnum*zlarnd( 5, iseed )
607 ELSE IF( imat.EQ.15 )
THEN
613 texp = one / max( one, dble( n-1 ) )
615 CALL zlarnv( 4, iseed, n, b )
623 $ ap( jc+j-2 ) = dcmplx( -one, -one )
624 ap( jc+j-1 ) = tscal*zlarnd( 5, iseed )
627 b( n ) = dcmplx( one, one )
635 $ ap( jc+1 ) = dcmplx( -one, -one )
636 ap( jc ) = tscal*zlarnd( 5, iseed )
639 b( 1 ) = dcmplx( one, one )
642 ELSE IF( imat.EQ.16 )
THEN
650 CALL zlarnv( 4, iseed, j, ap( jc ) )
652 ap( jc+j-1 ) = zlarnd( 5, iseed )*two
661 CALL zlarnv( 4, iseed, n-j+1, ap( jc ) )
663 ap( jc ) = zlarnd( 5, iseed )*two
670 CALL zlarnv( 2, iseed, n, b )
671 CALL zdscal( n, two, b, 1 )
673 ELSE IF( imat.EQ.17 )
THEN
681 tscal = ( one-ulp ) / tscal
682 DO 360 j = 1, n*( n+1 ) / 2
687 jc = ( n-1 )*n / 2 + 1
689 ap( jc ) = -tscal / dble( n+1 )
691 b( j ) = texp*( one-ulp )
693 ap( jc ) = -( tscal / dble( n+1 ) ) / dble( n+2 )
695 b( j-1 ) = texp*dble( n*n+n-1 )
699 b( 1 ) = ( dble( n+1 ) / dble( n+2 ) )*tscal
702 DO 380 j = 1, n - 1, 2
703 ap( jc+n-j ) = -tscal / dble( n+1 )
705 b( j ) = texp*( one-ulp )
707 ap( jc+n-j-1 ) = -( tscal / dble( n+1 ) ) / dble( n+2 )
709 b( j+1 ) = texp*dble( n*n+n-1 )
713 b( n ) = ( dble( n+1 ) / dble( n+2 ) )*tscal
716 ELSE IF( imat.EQ.18 )
THEN
725 CALL zlarnv( 4, iseed, j-1, ap( jc ) )
733 $
CALL zlarnv( 4, iseed, n-j, ap( jc+1 ) )
741 CALL zlarnv( 2, iseed, n, b )
742 iy = izamax( n, b, 1 )
743 bnorm = abs( b( iy ) )
744 bscal = bignum / max( one, bnorm )
745 CALL zdscal( n, bscal, b, 1 )
747 ELSE IF( imat.EQ.19 )
THEN
754 tleft = bignum / max( one, dble( n-1 ) )
755 tscal = bignum*( dble( n-1 ) / max( one, dble( n ) ) )
759 CALL zlarnv( 5, iseed, j, ap( jc ) )
760 CALL dlarnv( 1, iseed, j, rwork )
762 ap( jc+i-1 ) = ap( jc+i-1 )*( tleft+rwork( i )*tscal )
769 CALL zlarnv( 5, iseed, n-j+1, ap( jc ) )
770 CALL dlarnv( 1, iseed, n-j+1, rwork )
772 ap( jc+i-j ) = ap( jc+i-j )*
773 $ ( tleft+rwork( i-j+1 )*tscal )
778 CALL zlarnv( 2, iseed, n, b )
779 CALL zdscal( n, two, b, 1 )
785 IF( .NOT.lsame( trans,
'N' ) )
THEN
792 t = dble( ap( jr-i+j ) )
793 ap( jr-i+j ) = ap( jl )
806 t = dble( ap( jl+i-j ) )
807 ap( jl+i-j ) = ap( jr )
subroutine zlarnv(idist, iseed, n, x)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine dlarnv(idist, iseed, n, x)
DLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine zrot(n, cx, incx, cy, incy, c, s)
ZROT applies a plane rotation with real cosine and complex sine to a pair of complex vectors.
subroutine zrotg(a, b, c, s)
ZROTG generates a Givens rotation with real cosine and complex sine.
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zlatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
ZLATB4
subroutine zlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
ZLATMS
subroutine zlattp(imat, uplo, trans, diag, iseed, n, ap, b, work, rwork, info)
ZLATTP