163 SUBROUTINE slaqtr( LTRAN, LREAL, N, T, LDT, B, W, SCALE, X, WORK,
176 REAL B( * ), T( LDT, * ), WORK( * ), X( * )
183 parameter( zero = 0.0e+0, one = 1.0e+0 )
187 INTEGER I, IERR, J, J1, J2, JNEXT, K, N1, N2
188 REAL BIGNUM, EPS, REC, SCALOC, SI, SMIN, SMINW,
189 $ smlnum, sr, tjj, tmp, xj, xmax, xnorm, z
192 REAL D( 2, 2 ), V( 2, 2 )
196 REAL SASUM, SDOT, SLAMCH, SLANGE
197 EXTERNAL isamax, sasum, sdot, slamch, slange
220 smlnum = slamch(
'S' ) / eps
221 bignum = one / smlnum
223 xnorm = slange(
'M', n, n, t, ldt, d )
225 $ xnorm = max( xnorm, abs( w ), slange(
'M', n, 1, b, n, d ) )
226 smin = max( smlnum, eps*xnorm )
233 work( j ) = sasum( j-1, t( 1, j ), 1 )
236 IF( .NOT.lreal )
THEN
238 work( i ) = work( i ) + abs( b( i ) )
246 k = isamax( n1, x, 1 )
250 IF( xmax.GT.bignum )
THEN
251 scale = bignum / xmax
252 CALL sscal( n1, scale, x, 1 )
270 IF( t( j, j-1 ).NE.zero )
THEN
284 tjj = abs( t( j1, j1 ) )
286 IF( tjj.LT.smin )
THEN
295 IF( tjj.LT.one )
THEN
296 IF( xj.GT.bignum*tjj )
THEN
298 CALL sscal( n, rec, x, 1 )
303 x( j1 ) = x( j1 ) / tmp
311 IF( work( j1 ).GT.( bignum-xmax )*rec )
THEN
312 CALL sscal( n, rec, x, 1 )
317 CALL saxpy( j1-1, -x( j1 ), t( 1, j1 ), 1, x, 1 )
318 k = isamax( j1-1, x, 1 )
331 CALL slaln2( .false., 2, 1, smin, one, t( j1, j1 ),
332 $ ldt, one, one, d, 2, zero, zero, v, 2,
333 $ scaloc, xnorm, ierr )
337 IF( scaloc.NE.one )
THEN
338 CALL sscal( n, scaloc, x, 1 )
347 xj = max( abs( v( 1, 1 ) ), abs( v( 2, 1 ) ) )
350 IF( max( work( j1 ), work( j2 ) ).GT.
351 $ ( bignum-xmax )*rec )
THEN
352 CALL sscal( n, rec, x, 1 )
360 CALL saxpy( j1-1, -x( j1 ), t( 1, j1 ), 1, x, 1 )
361 CALL saxpy( j1-1, -x( j2 ), t( 1, j2 ), 1, x, 1 )
362 k = isamax( j1-1, x, 1 )
382 IF( t( j+1, j ).NE.zero )
THEN
396 IF( xmax.GT.one )
THEN
398 IF( work( j1 ).GT.( bignum-xj )*rec )
THEN
399 CALL sscal( n, rec, x, 1 )
405 x( j1 ) = x( j1 ) - sdot( j1-1, t( 1, j1 ), 1, x, 1 )
408 tjj = abs( t( j1, j1 ) )
410 IF( tjj.LT.smin )
THEN
416 IF( tjj.LT.one )
THEN
417 IF( xj.GT.bignum*tjj )
THEN
419 CALL sscal( n, rec, x, 1 )
424 x( j1 ) = x( j1 ) / tmp
425 xmax = max( xmax, abs( x( j1 ) ) )
434 xj = max( abs( x( j1 ) ), abs( x( j2 ) ) )
435 IF( xmax.GT.one )
THEN
437 IF( max( work( j2 ), work( j1 ) ).GT.( bignum-xj )*
439 CALL sscal( n, rec, x, 1 )
445 d( 1, 1 ) = x( j1 ) - sdot( j1-1, t( 1, j1 ), 1, x,
447 d( 2, 1 ) = x( j2 ) - sdot( j1-1, t( 1, j2 ), 1, x,
450 CALL slaln2( .true., 2, 1, smin, one, t( j1, j1 ),
451 $ ldt, one, one, d, 2, zero, zero, v, 2,
452 $ scaloc, xnorm, ierr )
456 IF( scaloc.NE.one )
THEN
457 CALL sscal( n, scaloc, x, 1 )
462 xmax = max( abs( x( j1 ) ), abs( x( j2 ) ), xmax )
470 sminw = max( eps*abs( w ), smin )
483 IF( t( j, j-1 ).NE.zero )
THEN
498 xj = abs( x( j1 ) ) + abs( x( n+j1 ) )
499 tjj = abs( t( j1, j1 ) ) + abs( z )
501 IF( tjj.LT.sminw )
THEN
510 IF( tjj.LT.one )
THEN
511 IF( xj.GT.bignum*tjj )
THEN
513 CALL sscal( n2, rec, x, 1 )
518 CALL sladiv( x( j1 ), x( n+j1 ), tmp, z, sr, si )
521 xj = abs( x( j1 ) ) + abs( x( n+j1 ) )
528 IF( work( j1 ).GT.( bignum-xmax )*rec )
THEN
529 CALL sscal( n2, rec, x, 1 )
535 CALL saxpy( j1-1, -x( j1 ), t( 1, j1 ), 1, x, 1 )
536 CALL saxpy( j1-1, -x( n+j1 ), t( 1, j1 ), 1,
539 x( 1 ) = x( 1 ) + b( j1 )*x( n+j1 )
540 x( n+1 ) = x( n+1 ) - b( j1 )*x( j1 )
544 xmax = max( xmax, abs( x( k ) )+
555 d( 1, 2 ) = x( n+j1 )
556 d( 2, 2 ) = x( n+j2 )
557 CALL slaln2( .false., 2, 2, sminw, one, t( j1, j1 ),
558 $ ldt, one, one, d, 2, zero, -w, v, 2,
559 $ scaloc, xnorm, ierr )
563 IF( scaloc.NE.one )
THEN
564 CALL sscal( 2*n, scaloc, x, 1 )
569 x( n+j1 ) = v( 1, 2 )
570 x( n+j2 ) = v( 2, 2 )
575 xj = max( abs( v( 1, 1 ) )+abs( v( 1, 2 ) ),
576 $ abs( v( 2, 1 ) )+abs( v( 2, 2 ) ) )
579 IF( max( work( j1 ), work( j2 ) ).GT.
580 $ ( bignum-xmax )*rec )
THEN
581 CALL sscal( n2, rec, x, 1 )
589 CALL saxpy( j1-1, -x( j1 ), t( 1, j1 ), 1, x, 1 )
590 CALL saxpy( j1-1, -x( j2 ), t( 1, j2 ), 1, x, 1 )
592 CALL saxpy( j1-1, -x( n+j1 ), t( 1, j1 ), 1,
594 CALL saxpy( j1-1, -x( n+j2 ), t( 1, j2 ), 1,
597 x( 1 ) = x( 1 ) + b( j1 )*x( n+j1 ) +
599 x( n+1 ) = x( n+1 ) - b( j1 )*x( j1 ) -
604 xmax = max( abs( x( k ) )+abs( x( k+n ) ),
624 IF( t( j+1, j ).NE.zero )
THEN
637 xj = abs( x( j1 ) ) + abs( x( j1+n ) )
638 IF( xmax.GT.one )
THEN
640 IF( work( j1 ).GT.( bignum-xj )*rec )
THEN
641 CALL sscal( n2, rec, x, 1 )
647 x( j1 ) = x( j1 ) - sdot( j1-1, t( 1, j1 ), 1, x, 1 )
648 x( n+j1 ) = x( n+j1 ) - sdot( j1-1, t( 1, j1 ), 1,
651 x( j1 ) = x( j1 ) - b( j1 )*x( n+1 )
652 x( n+j1 ) = x( n+j1 ) + b( j1 )*x( 1 )
654 xj = abs( x( j1 ) ) + abs( x( j1+n ) )
663 tjj = abs( t( j1, j1 ) ) + abs( z )
665 IF( tjj.LT.sminw )
THEN
671 IF( tjj.LT.one )
THEN
672 IF( xj.GT.bignum*tjj )
THEN
674 CALL sscal( n2, rec, x, 1 )
679 CALL sladiv( x( j1 ), x( n+j1 ), tmp, -z, sr, si )
682 xmax = max( abs( x( j1 ) )+abs( x( j1+n ) ), xmax )
691 xj = max( abs( x( j1 ) )+abs( x( n+j1 ) ),
692 $ abs( x( j2 ) )+abs( x( n+j2 ) ) )
693 IF( xmax.GT.one )
THEN
695 IF( max( work( j1 ), work( j2 ) ).GT.
696 $ ( bignum-xj ) / xmax )
THEN
697 CALL sscal( n2, rec, x, 1 )
703 d( 1, 1 ) = x( j1 ) - sdot( j1-1, t( 1, j1 ), 1, x,
705 d( 2, 1 ) = x( j2 ) - sdot( j1-1, t( 1, j2 ), 1, x,
707 d( 1, 2 ) = x( n+j1 ) - sdot( j1-1, t( 1, j1 ), 1,
709 d( 2, 2 ) = x( n+j2 ) - sdot( j1-1, t( 1, j2 ), 1,
711 d( 1, 1 ) = d( 1, 1 ) - b( j1 )*x( n+1 )
712 d( 2, 1 ) = d( 2, 1 ) - b( j2 )*x( n+1 )
713 d( 1, 2 ) = d( 1, 2 ) + b( j1 )*x( 1 )
714 d( 2, 2 ) = d( 2, 2 ) + b( j2 )*x( 1 )
716 CALL slaln2( .true., 2, 2, sminw, one, t( j1, j1 ),
717 $ ldt, one, one, d, 2, zero, w, v, 2,
718 $ scaloc, xnorm, ierr )
722 IF( scaloc.NE.one )
THEN
723 CALL sscal( n2, scaloc, x, 1 )
728 x( n+j1 ) = v( 1, 2 )
729 x( n+j2 ) = v( 2, 2 )
730 xmax = max( abs( x( j1 ) )+abs( x( n+j1 ) ),
731 $ abs( x( j2 ) )+abs( x( n+j2 ) ), xmax )
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
subroutine sladiv(a, b, c, d, p, q)
SLADIV performs complex division in real arithmetic, avoiding unnecessary overflow.
subroutine slaln2(ltrans, na, nw, smin, ca, a, lda, d1, d2, b, ldb, wr, wi, x, ldx, scale, xnorm, info)
SLALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form.
subroutine slaqtr(ltran, lreal, n, t, ldt, b, w, scale, x, work, info)
SLAQTR solves a real quasi-triangular system of equations, or a complex quasi-triangular system of sp...
subroutine sscal(n, sa, sx, incx)
SSCAL