1 SUBROUTINE dlaln2( LTRANS, NA, NW, SMIN, CA, A, LDA, D1, D2, B,
2 $ LDB, WR, WI, X, LDX, SCALE, XNORM, INFO )
11 INTEGER INFO, LDA, LDB, LDX, NA, NW
12 DOUBLE PRECISION CA, D1, D2, SCALE, SMIN, WI, WR, XNORM
15 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), X( LDX, * )
135 DOUBLE PRECISION ZERO, ONE
136 parameter( zero = 0.0d0, one = 1.0d0 )
138 parameter( two = 2.0d0 )
142 DOUBLE PRECISION BBND, BI1, BI2, BIGNUM, BNORM, BR1, BR2, CI21,
143 $ ci22, cmax, cnorm, cr21, cr22, csi, csr, li21,
144 $ lr21, smini, smlnum, temp, u22abs, ui11, ui11r,
145 $ ui12, ui12s, ui22, ur11, ur11r, ur12, ur12s,
146 $ ur22, xi1, xi2, xr1, xr2
149 LOGICAL RSWAP( 4 ), ZSWAP( 4 )
150 INTEGER IPIVOT( 4, 4 )
151 DOUBLE PRECISION CI( 2, 2 ), CIV( 4 ), CR( 2, 2 ), CRV( 4 )
154 DOUBLE PRECISION DLAMCH
164 equivalence( ci( 1, 1 ), civ( 1 ) ),
165 $ ( cr( 1, 1 ), crv( 1 ) )
168 DATA zswap / .false., .false., .true., .true. /
169 DATA rswap / .false., .true., .false., .true. /
170 DATA ipivot / 1, 2, 3, 4, 2, 1, 4, 3, 3, 4, 1, 2, 4,
177 smlnum = two*dlamch(
'Safe minimum' )
178 bignum = one / smlnum
179 smini = max( smin, smlnum )
199 csr = ca*a( 1, 1 ) - wr*d1
204 IF( cnorm.LT.smini )
THEN
212 bnorm = abs( b( 1, 1 ) )
213 IF( cnorm.LT.one .AND. bnorm.GT.one )
THEN
214 IF( bnorm.GT.bignum*cnorm )
215 $ scale = one / bnorm
220 x( 1, 1 ) = ( b( 1, 1 )*scale ) / csr
221 xnorm = abs( x( 1, 1 ) )
228 csr = ca*a( 1, 1 ) - wr*d1
230 cnorm = abs( csr ) + abs( csi )
234 IF( cnorm.LT.smini )
THEN
243 bnorm = abs( b( 1, 1 ) ) + abs( b( 1, 2 ) )
244 IF( cnorm.LT.one .AND. bnorm.GT.one )
THEN
245 IF( bnorm.GT.bignum*cnorm )
246 $ scale = one / bnorm
251 CALL dladiv( scale*b( 1, 1 ), scale*b( 1, 2 ), csr, csi,
252 $ x( 1, 1 ), x( 1, 2 ) )
253 xnorm = abs( x( 1, 1 ) ) + abs( x( 1, 2 ) )
262 cr( 1, 1 ) = ca*a( 1, 1 ) - wr*d1
263 cr( 2, 2 ) = ca*a( 2, 2 ) - wr*d2
265 cr( 1, 2 ) = ca*a( 2, 1 )
266 cr( 2, 1 ) = ca*a( 1, 2 )
268 cr( 2, 1 ) = ca*a( 2, 1 )
269 cr( 1, 2 ) = ca*a( 1, 2 )
282 IF( abs( crv( j ) ).GT.cmax )
THEN
283 cmax = abs( crv( j ) )
290 IF( cmax.LT.smini )
THEN
291 bnorm = max( abs( b( 1, 1 ) ), abs( b( 2, 1 ) ) )
292 IF( smini.LT.one .AND. bnorm.GT.one )
THEN
293 IF( bnorm.GT.bignum*smini )
294 $ scale = one / bnorm
297 x( 1, 1 ) = temp*b( 1, 1 )
298 x( 2, 1 ) = temp*b( 2, 1 )
307 cr21 = crv( ipivot( 2, icmax ) )
308 ur12 = crv( ipivot( 3, icmax ) )
309 cr22 = crv( ipivot( 4, icmax ) )
312 ur22 = cr22 - ur12*lr21
316 IF( abs( ur22 ).LT.smini )
THEN
320 IF( rswap( icmax ) )
THEN
328 bbnd = max( abs( br1*( ur22*ur11r ) ), abs( br2 ) )
329 IF( bbnd.GT.one .AND. abs( ur22 ).LT.one )
THEN
330 IF( bbnd.GE.bignum*abs( ur22 ) )
334 xr2 = ( br2*scale ) / ur22
335 xr1 = ( scale*br1 )*ur11r - xr2*( ur11r*ur12 )
336 IF( zswap( icmax ) )
THEN
343 xnorm = max( abs( xr1 ), abs( xr2 ) )
347 IF( xnorm.GT.one .AND. cmax.GT.one )
THEN
348 IF( xnorm.GT.bignum / cmax )
THEN
350 x( 1, 1 ) = temp*x( 1, 1 )
351 x( 2, 1 ) = temp*x( 2, 1 )
370 IF( abs( crv( j ) )+abs( civ( j ) ).GT.cmax )
THEN
371 cmax = abs( crv( j ) ) + abs( civ( j ) )
378 IF( cmax.LT.smini )
THEN
379 bnorm = max( abs( b( 1, 1 ) )+abs( b( 1, 2 ) ),
380 $ abs( b( 2, 1 ) )+abs( b( 2, 2 ) ) )
381 IF( smini.LT.one .AND. bnorm.GT.one )
THEN
382 IF( bnorm.GT.bignum*smini )
383 $ scale = one / bnorm
386 x( 1, 1 ) = temp*b( 1, 1 )
387 x( 2, 1 ) = temp*b( 2, 1 )
388 x( 1, 2 ) = temp*b( 1, 2 )
389 x( 2, 2 ) = temp*b( 2, 2 )
399 cr21 = crv( ipivot( 2, icmax ) )
400 ci21 = civ( ipivot( 2, icmax ) )
401 ur12 = crv( ipivot( 3, icmax ) )
402 ui12 = civ( ipivot( 3, icmax ) )
403 cr22 = crv( ipivot( 4, icmax ) )
404 ci22 = civ( ipivot( 4, icmax ) )
405 IF( icmax.EQ.1 .OR. icmax.EQ.4 )
THEN
409 IF( abs( ur11 ).GT.abs( ui11 ) )
THEN
411 ur11r = one / ( ur11*( one+temp**2 ) )
415 ui11r = -one / ( ui11*( one+temp**2 ) )
422 ur22 = cr22 - ur12*lr21
423 ui22 = ci22 - ur12*li21
434 ur22 = cr22 - ur12*lr21 + ui12*li21
435 ui22 = -ur12*li21 - ui12*lr21
437 u22abs = abs( ur22 ) + abs( ui22 )
441 IF( u22abs.LT.smini )
THEN
446 IF( rswap( icmax ) )
THEN
457 br2 = br2 - lr21*br1 + li21*bi1
458 bi2 = bi2 - li21*br1 - lr21*bi1
459 bbnd = max( ( abs( br1 )+abs( bi1 ) )*
460 $ ( u22abs*( abs( ur11r )+abs( ui11r ) ) ),
461 $ abs( br2 )+abs( bi2 ) )
462 IF( bbnd.GT.one .AND. u22abs.LT.one )
THEN
463 IF( bbnd.GE.bignum*u22abs )
THEN
472 CALL dladiv( br2, bi2, ur22, ui22, xr2, xi2 )
473 xr1 = ur11r*br1 - ui11r*bi1 - ur12s*xr2 + ui12s*xi2
474 xi1 = ui11r*br1 + ur11r*bi1 - ui12s*xr2 - ur12s*xi2
475 IF( zswap( icmax ) )
THEN
486 xnorm = max( abs( xr1 )+abs( xi1 ), abs( xr2 )+abs( xi2 ) )
490 IF( xnorm.GT.one .AND. cmax.GT.one )
THEN
491 IF( xnorm.GT.bignum / cmax )
THEN
493 x( 1, 1 ) = temp*x( 1, 1 )
494 x( 2, 1 ) = temp*x( 2, 1 )
495 x( 1, 2 ) = temp*x( 1, 2 )
496 x( 2, 2 ) = temp*x( 2, 2 )
subroutine dladiv(A, B, C, D, P, Q)
subroutine dlaln2(LTRANS, NA, NW, SMIN, CA, A, LDA, D1, D2, B, LDB, WR, WI, X, LDX, SCALE, XNORM, INFO)