129 SUBROUTINE clattp( IMAT, UPLO, TRANS, DIAG, ISEED, N, AP, B, WORK,
137 CHARACTER DIAG, TRANS, UPLO
138 INTEGER IMAT, INFO, N
143 COMPLEX AP( * ), B( * ), WORK( * )
150 parameter( one = 1.0e+0, two = 2.0e+0, zero = 0.0e+0 )
154 CHARACTER DIST, PACKIT, TYPE
156 INTEGER I, IY, J, JC, JCNEXT, JCOUNT, JJ, JL, JR, JX,
158 REAL ANORM, BIGNUM, BNORM, BSCAL, C, CNDNUM, REXP,
159 $ sfac, smlnum, t, texp, tleft, tscal, ulp, unfl,
161 COMPLEX CTEMP, PLUS1, PLUS2, RA, RB, S, STAR1
168 EXTERNAL lsame, icamax, slamch, clarnd
175 INTRINSIC abs, cmplx, conjg, max, real, sqrt
179 path( 1: 1 ) =
'Complex precision'
181 unfl = slamch(
'Safe minimum' )
182 ulp = slamch(
'Epsilon' )*slamch(
'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 clatb4( path, imat, n, n,
TYPE, kl, ku, anorm, mode,
205 CALL clatb4( path, -imat, n, n,
TYPE, kl, ku, anorm, mode,
213 CALL clatms( 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.25*clarnd( 5, iseed )
329 plus1 = sfac*clarnd( 5, iseed )
331 plus2 = star1 / plus1
337 plus1 = star1 / plus2
338 rexp = real( clarnd( 2, iseed ) )
339 IF( rexp.LT.zero )
THEN
340 star1 = -sfac**( one-rexp )*clarnd( 5, iseed )
342 star1 = sfac**( one+rexp )*clarnd( 5, iseed )
347 x = sqrt( cndnum ) - one / sqrt( cndnum )
349 y = sqrt( two / real( 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 crotg( ra, rb, c, s )
408 ctemp = c*ap( jx+j ) + s*ap( jx+j+1 )
409 ap( jx+j+1 ) = -conjg( s )*ap( jx+j ) +
419 $
CALL crot( 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 crotg( ra, rb, c, s )
438 $
CALL crot( 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 ) = -conjg( s )*ap( jx+j-i ) -
456 ap( jc+1 ) = -ap( jc+1 )
465 ELSE IF( imat.EQ.11 )
THEN
474 CALL clarnv( 4, iseed, j-1, ap( jc ) )
475 ap( jc+j-1 ) = clarnd( 5, iseed )*two
482 $
CALL clarnv( 4, iseed, n-j, ap( jc+1 ) )
483 ap( jc ) = clarnd( 5, iseed )*two
490 CALL clarnv( 2, iseed, n, b )
491 iy = icamax( n, b, 1 )
492 bnorm = abs( b( iy ) )
493 bscal = bignum / max( one, bnorm )
494 CALL csscal( n, bscal, b, 1 )
496 ELSE IF( imat.EQ.12 )
THEN
502 CALL clarnv( 2, iseed, n, b )
503 tscal = one / max( one, real( n-1 ) )
507 CALL clarnv( 4, iseed, j-1, ap( jc ) )
508 CALL csscal( j-1, tscal, ap( jc ), 1 )
509 ap( jc+j-1 ) = clarnd( 5, iseed )
512 ap( n*( n+1 ) / 2 ) = smlnum*ap( n*( n+1 ) / 2 )
516 CALL clarnv( 2, iseed, n-j, ap( jc+1 ) )
517 CALL csscal( n-j, tscal, ap( jc+1 ), 1 )
518 ap( jc ) = clarnd( 5, iseed )
521 ap( 1 ) = smlnum*ap( 1 )
524 ELSE IF( imat.EQ.13 )
THEN
530 CALL clarnv( 2, iseed, n, b )
534 CALL clarnv( 4, iseed, j-1, ap( jc ) )
535 ap( jc+j-1 ) = clarnd( 5, iseed )
538 ap( n*( n+1 ) / 2 ) = smlnum*ap( n*( n+1 ) / 2 )
542 CALL clarnv( 4, iseed, n-j, ap( jc+1 ) )
543 ap( jc ) = clarnd( 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*clarnd( 5, iseed )
565 ap( jc+j-1 ) = clarnd( 5, iseed )
579 IF( jcount.LE.2 )
THEN
580 ap( jc ) = smlnum*clarnd( 5, iseed )
582 ap( jc ) = clarnd( 5, iseed )
597 b( i-1 ) = smlnum*clarnd( 5, iseed )
601 DO 290 i = 1, n - 1, 2
603 b( i+1 ) = smlnum*clarnd( 5, iseed )
607 ELSE IF( imat.EQ.15 )
THEN
613 texp = one / max( one, real( n-1 ) )
615 CALL clarnv( 4, iseed, n, b )
623 $ ap( jc+j-2 ) = cmplx( -one, -one )
624 ap( jc+j-1 ) = tscal*clarnd( 5, iseed )
627 b( n ) = cmplx( one, one )
635 $ ap( jc+1 ) = cmplx( -one, -one )
636 ap( jc ) = tscal*clarnd( 5, iseed )
639 b( 1 ) = cmplx( one, one )
642 ELSE IF( imat.EQ.16 )
THEN
650 CALL clarnv( 4, iseed, j, ap( jc ) )
652 ap( jc+j-1 ) = clarnd( 5, iseed )*two
661 CALL clarnv( 4, iseed, n-j+1, ap( jc ) )
663 ap( jc ) = clarnd( 5, iseed )*two
670 CALL clarnv( 2, iseed, n, b )
671 CALL csscal( 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 / real( n+1 )
691 b( j ) = texp*( one-ulp )
693 ap( jc ) = -( tscal / real( n+1 ) ) / real( n+2 )
695 b( j-1 ) = texp*real( n*n+n-1 )
699 b( 1 ) = ( real( n+1 ) / real( n+2 ) )*tscal
702 DO 380 j = 1, n - 1, 2
703 ap( jc+n-j ) = -tscal / real( n+1 )
705 b( j ) = texp*( one-ulp )
707 ap( jc+n-j-1 ) = -( tscal / real( n+1 ) ) / real( n+2 )
709 b( j+1 ) = texp*real( n*n+n-1 )
713 b( n ) = ( real( n+1 ) / real( n+2 ) )*tscal
716 ELSE IF( imat.EQ.18 )
THEN
725 CALL clarnv( 4, iseed, j-1, ap( jc ) )
733 $
CALL clarnv( 4, iseed, n-j, ap( jc+1 ) )
741 CALL clarnv( 2, iseed, n, b )
742 iy = icamax( n, b, 1 )
743 bnorm = abs( b( iy ) )
744 bscal = bignum / max( one, bnorm )
745 CALL csscal( n, bscal, b, 1 )
747 ELSE IF( imat.EQ.19 )
THEN
754 tleft = bignum / max( one, real( n-1 ) )
755 tscal = bignum*( real( n-1 ) / max( one, real( n ) ) )
759 CALL clarnv( 5, iseed, j, ap( jc ) )
760 CALL slarnv( 1, iseed, j, rwork )
762 ap( jc+i-1 ) = ap( jc+i-1 )*( tleft+rwork( i )*tscal )
769 CALL clarnv( 5, iseed, n-j+1, ap( jc ) )
770 CALL slarnv( 1, iseed, n-j+1, rwork )
772 ap( jc+i-j ) = ap( jc+i-j )*
773 $ ( tleft+rwork( i-j+1 )*tscal )
778 CALL clarnv( 2, iseed, n, b )
779 CALL csscal( n, two, b, 1 )
785 IF( .NOT.lsame( trans,
'N' ) )
THEN
792 t = real( ap( jr-i+j ) )
793 ap( jr-i+j ) = ap( jl )
806 t = real( ap( jl+i-j ) )
807 ap( jl+i-j ) = ap( jr )
subroutine clatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
CLATB4
subroutine clatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
CLATMS
subroutine clattp(imat, uplo, trans, diag, iseed, n, ap, b, work, rwork, info)
CLATTP
subroutine slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine clarnv(idist, iseed, n, x)
CLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine crot(n, cx, incx, cy, incy, c, s)
CROT applies a plane rotation with real cosine and complex sine to a pair of complex vectors.
subroutine crotg(a, b, c, s)
CROTG generates a Givens rotation with real cosine and complex sine.
subroutine csscal(n, sa, cx, incx)
CSSCAL