133 SUBROUTINE slattb( IMAT, UPLO, TRANS, DIAG, ISEED, N, KD, AB,
134 $ LDAB, B, WORK, INFO )
141 CHARACTER DIAG, TRANS, UPLO
142 INTEGER IMAT, INFO, KD, LDAB, N
146 REAL AB( LDAB, * ), B( * ), WORK( * )
153 parameter( one = 1.0e+0, two = 2.0e+0, zero = 0.0e+0 )
157 CHARACTER DIST, PACKIT, TYPE
159 INTEGER I, IOFF, IY, J, JCOUNT, KL, KU, LENJ, MODE
160 REAL ANORM, BIGNUM, BNORM, BSCAL, CNDNUM, PLUS1,
161 $ plus2, rexp, sfac, smlnum, star1, texp, tleft,
162 $ tnorm, tscal, ulp, unfl
168 EXTERNAL lsame, isamax, slamch, slarnd
174 INTRINSIC abs, max, min, real, sign, sqrt
178 path( 1: 1 ) =
'Single precision'
180 unfl = slamch(
'Safe minimum' )
181 ulp = slamch(
'Epsilon' )*slamch(
'Base' )
183 bignum = ( one-ulp ) / smlnum
184 IF( ( imat.GE.6 .AND. imat.LE.9 ) .OR. imat.EQ.17 )
THEN
198 upper = lsame( uplo,
'U' )
200 CALL slatb4( path, imat, n, n,
TYPE, kl, ku, anorm, mode,
203 ioff = 1 + max( 0, kd-n+1 )
207 CALL slatb4( path, -imat, n, n,
TYPE, kl, ku, anorm, mode,
218 CALL slatms( n, n, dist, iseed,
TYPE, b, mode, cndnum, anorm,
219 $ kl, ku, packit, ab( ioff, 1 ), ldab, work, info )
226 ELSE IF( imat.EQ.6 )
THEN
229 DO 10 i = max( 1, kd+2-j ), kd
237 DO 30 i = 2, min( kd+1, n-j+1 )
248 ELSE IF( imat.LE.9 )
THEN
249 tnorm = sqrt( cndnum )
255 DO 50 i = max( 1, kd+2-j ), kd
258 ab( kd+1, j ) = real( j )
262 DO 70 i = 2, min( kd+1, n-j+1 )
265 ab( 1, j ) = real( j )
274 ab( 1, 2 ) = sign( tnorm, slarnd( 2, iseed ) )
276 CALL slarnv( 2, iseed, lenj, work )
278 ab( 1, 2*( j+1 ) ) = tnorm*work( j )
281 ab( 2, 1 ) = sign( tnorm, slarnd( 2, iseed ) )
283 CALL slarnv( 2, iseed, lenj, work )
285 ab( 2, 2*j+1 ) = tnorm*work( j )
288 ELSE IF( kd.GT.1 )
THEN
306 star1 = sign( tnorm, slarnd( 2, iseed ) )
308 plus1 = sign( sfac, slarnd( 2, iseed ) )
310 plus2 = star1 / plus1
316 plus1 = star1 / plus2
321 rexp = slarnd( 2, iseed )
322 IF( rexp.LT.zero )
THEN
323 star1 = -sfac**( one-rexp )
325 star1 = sfac**( one+rexp )
333 CALL scopy( n-1, work, 1, ab( kd, 2 ), ldab )
334 CALL scopy( n-2, work( n+1 ), 1, ab( kd-1, 3 ), ldab )
336 CALL scopy( n-1, work, 1, ab( 2, 1 ), ldab )
337 CALL scopy( n-2, work( n+1 ), 1, ab( 3, 1 ), ldab )
345 ELSE IF( imat.EQ.10 )
THEN
353 lenj = min( j, kd+1 )
354 CALL slarnv( 2, iseed, lenj, ab( kd+2-lenj, j ) )
355 ab( kd+1, j ) = sign( two, ab( kd+1, j ) )
359 lenj = min( n-j+1, kd+1 )
361 $
CALL slarnv( 2, iseed, lenj, ab( 1, j ) )
362 ab( 1, j ) = sign( two, ab( 1, j ) )
368 CALL slarnv( 2, iseed, n, b )
369 iy = isamax( n, b, 1 )
370 bnorm = abs( b( iy ) )
371 bscal = bignum / max( one, bnorm )
372 CALL sscal( n, bscal, b, 1 )
374 ELSE IF( imat.EQ.11 )
THEN
380 CALL slarnv( 2, iseed, n, b )
381 tscal = one / real( kd+1 )
384 lenj = min( j, kd+1 )
385 CALL slarnv( 2, iseed, lenj, ab( kd+2-lenj, j ) )
386 CALL sscal( lenj-1, tscal, ab( kd+2-lenj, j ), 1 )
387 ab( kd+1, j ) = sign( one, ab( kd+1, j ) )
389 ab( kd+1, n ) = smlnum*ab( kd+1, n )
392 lenj = min( n-j+1, kd+1 )
393 CALL slarnv( 2, iseed, lenj, ab( 1, j ) )
395 $
CALL sscal( lenj-1, tscal, ab( 2, j ), 1 )
396 ab( 1, j ) = sign( one, ab( 1, j ) )
398 ab( 1, 1 ) = smlnum*ab( 1, 1 )
401 ELSE IF( imat.EQ.12 )
THEN
407 CALL slarnv( 2, iseed, n, b )
410 lenj = min( j, kd+1 )
411 CALL slarnv( 2, iseed, lenj, ab( kd+2-lenj, j ) )
412 ab( kd+1, j ) = sign( one, ab( kd+1, j ) )
414 ab( kd+1, n ) = smlnum*ab( kd+1, n )
417 lenj = min( n-j+1, kd+1 )
418 CALL slarnv( 2, iseed, lenj, ab( 1, j ) )
419 ab( 1, j ) = sign( one, ab( 1, j ) )
421 ab( 1, 1 ) = smlnum*ab( 1, 1 )
424 ELSE IF( imat.EQ.13 )
THEN
433 DO 180 i = max( 1, kd+1-( j-1 ) ), kd
436 IF( jcount.LE.2 )
THEN
437 ab( kd+1, j ) = smlnum
448 DO 200 i = 2, min( n-j+1, kd+1 )
451 IF( jcount.LE.2 )
THEN
472 DO 230 i = 1, n - 1, 2
478 ELSE IF( imat.EQ.14 )
THEN
484 texp = one / real( kd+1 )
486 CALL slarnv( 2, iseed, n, b )
489 DO 240 i = max( 1, kd+2-j ), kd
492 IF( j.GT.1 .AND. kd.GT.0 )
494 ab( kd+1, j ) = tscal
499 DO 260 i = 3, min( n-j+1, kd+1 )
502 IF( j.LT.n .AND. kd.GT.0 )
509 ELSE IF( imat.EQ.15 )
THEN
516 lenj = min( j, kd+1 )
517 CALL slarnv( 2, iseed, lenj, ab( kd+2-lenj, j ) )
519 ab( kd+1, j ) = sign( two, ab( kd+1, j ) )
526 lenj = min( n-j+1, kd+1 )
527 CALL slarnv( 2, iseed, lenj, ab( 1, j ) )
529 ab( 1, j ) = sign( two, ab( 1, j ) )
535 CALL slarnv( 2, iseed, n, b )
536 CALL sscal( n, two, b, 1 )
538 ELSE IF( imat.EQ.16 )
THEN
546 tscal = ( one-ulp ) / tscal
556 DO 320 i = j, max( 1, j-kd+1 ), -2
557 ab( 1+( j-i ), i ) = -tscal / real( kd+2 )
559 b( i ) = texp*( one-ulp )
560 IF( i.GT.max( 1, j-kd+1 ) )
THEN
561 ab( 2+( j-i ), i-1 ) = -( tscal / real( kd+2 ) )
563 ab( kd+1, i-1 ) = one
564 b( i-1 ) = texp*real( ( kd+1 )*( kd+1 )+kd )
568 b( max( 1, j-kd+1 ) ) = ( real( kd+2 ) /
569 $ real( kd+3 ) )*tscal
574 lenj = min( kd+1, n-j+1 )
575 DO 340 i = j, min( n, j+kd-1 ), 2
576 ab( lenj-( i-j ), j ) = -tscal / real( kd+2 )
578 b( j ) = texp*( one-ulp )
579 IF( i.LT.min( n, j+kd-1 ) )
THEN
580 ab( lenj-( i-j+1 ), i+1 ) = -( tscal /
581 $ real( kd+2 ) ) / real( kd+3 )
583 b( i+1 ) = texp*real( ( kd+1 )*( kd+1 )+kd )
587 b( min( n, j+kd-1 ) ) = ( real( kd+2 ) /
588 $ real( kd+3 ) )*tscal
598 ELSE IF( imat.EQ.17 )
THEN
606 lenj = min( j-1, kd )
607 CALL slarnv( 2, iseed, lenj, ab( kd+1-lenj, j ) )
608 ab( kd+1, j ) = real( j )
612 lenj = min( n-j, kd )
614 $
CALL slarnv( 2, iseed, lenj, ab( 2, j ) )
615 ab( 1, j ) = real( j )
621 CALL slarnv( 2, iseed, n, b )
622 iy = isamax( n, b, 1 )
623 bnorm = abs( b( iy ) )
624 bscal = bignum / max( one, bnorm )
625 CALL sscal( n, bscal, b, 1 )
627 ELSE IF( imat.EQ.18 )
THEN
633 tleft = bignum / max( one, real( kd ) )
634 tscal = bignum*( real( kd ) / real( kd+1 ) )
637 lenj = min( j, kd+1 )
638 CALL slarnv( 2, iseed, lenj, ab( kd+2-lenj, j ) )
639 DO 390 i = kd + 2 - lenj, kd + 1
640 ab( i, j ) = sign( tleft, ab( i, j ) ) +
646 lenj = min( n-j+1, kd+1 )
647 CALL slarnv( 2, iseed, lenj, ab( 1, j ) )
649 ab( i, j ) = sign( tleft, ab( i, j ) ) +
654 CALL slarnv( 2, iseed, n, b )
655 CALL sscal( n, two, b, 1 )
660 IF( .NOT.lsame( trans,
'N' ) )
THEN
663 lenj = min( n-2*j+1, kd+1 )
664 CALL sswap( lenj, ab( kd+1, j ), ldab-1,
665 $ ab( kd+2-lenj, n-j+1 ), -1 )
669 lenj = min( n-2*j+1, kd+1 )
670 CALL sswap( lenj, ab( 1, j ), 1, ab( lenj, n-j+2-lenj ),
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 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 slattb(imat, uplo, trans, diag, iseed, n, kd, ab, ldab, b, work, info)
SLATTB