90 SUBROUTINE dget31( RMAX, LMAX, NINFO, KNT )
107 DOUBLE PRECISION ZERO, HALF, ONE
108 parameter( zero = 0.0d0, half = 0.5d0, one = 1.0d0 )
109 DOUBLE PRECISION TWO, THREE, FOUR
110 parameter( two = 2.0d0, three = 3.0d0, four = 4.0d0 )
111 DOUBLE PRECISION SEVEN, TEN
112 parameter( seven = 7.0d0, ten = 10.0d0 )
113 DOUBLE PRECISION TWNONE
114 parameter( twnone = 21.0d0 )
117 INTEGER IA, IB, ICA, ID1, ID2, INFO, ISMIN, ITRANS,
119 DOUBLE PRECISION BIGNUM, CA, D1, D2, DEN, EPS, RES, SCALE, SMIN,
120 $ SMLNUM, TMP, UNFL, WI, WR, XNORM
123 LOGICAL LTRANS( 0: 1 )
124 DOUBLE PRECISION A( 2, 2 ), B( 2, 2 ), VAB( 3 ), VCA( 5 ),
125 $ VDD( 4 ), VSMIN( 4 ), VWI( 4 ), VWR( 4 ),
129 DOUBLE PRECISION DLAMCH
136 INTRINSIC abs, max, sqrt
139 DATA ltrans / .false., .true. /
147 smlnum = dlamch(
'S' ) / eps
148 bignum = one / smlnum
154 vsmin( 3 ) = one / ( ten*ten )
155 vsmin( 4 ) = one / eps
156 vab( 1 ) = sqrt( smlnum )
158 vab( 3 ) = sqrt( bignum )
167 vdd( 1 ) = sqrt( smlnum )
170 vdd( 4 ) = sqrt( bignum )
172 vca( 2 ) = sqrt( smlnum )
193 smin = vsmin( ismin )
198 a( 1, 1 ) = vab( ia )
200 b( 1, 1 ) = vab( ib )
202 IF( d1.EQ.one .AND. d2.EQ.one .AND. ca.EQ.
204 wr = vwr( iwr )*a( 1, 1 )
209 CALL dlaln2( ltrans( itrans ), na, nw,
210 $ smin, ca, a, 2, d1, d2, b, 2,
211 $ wr, wi, x, 2, scale, xnorm,
214 $ ninfo( 1 ) = ninfo( 1 ) + 1
216 $ ninfo( 2 ) = ninfo( 2 ) + 1
217 res = abs( ( ca*a( 1, 1 )-wr*d1 )*
218 $ x( 1, 1 )-scale*b( 1, 1 ) )
220 den = max( eps*( abs( ( ca*a( 1,
221 $ 1 )-wr*d1 )*x( 1, 1 ) ) ),
224 den = max( smin*abs( x( 1, 1 ) ),
228 IF( abs( x( 1, 1 ) ).LT.unfl .AND.
229 $ abs( b( 1, 1 ) ).LE.smlnum*
230 $ abs( ca*a( 1, 1 )-wr*d1 ) )res = zero
232 $ res = res + one / eps
233 res = res + abs( xnorm-abs( x( 1, 1 ) ) )
234 $ / max( smlnum, xnorm ) / eps
235 IF( info.NE.0 .AND. info.NE.1 )
236 $ res = res + one / eps
238 IF( res.GT.rmax )
THEN
249 a( 1, 1 ) = vab( ia )
251 b( 1, 1 ) = vab( ib )
252 b( 1, 2 ) = -half*vab( ib )
254 IF( d1.EQ.one .AND. d2.EQ.one .AND. ca.EQ.
256 wr = vwr( iwr )*a( 1, 1 )
261 IF( d1.EQ.one .AND. d2.EQ.one .AND.
263 wi = vwi( iwi )*a( 1, 1 )
267 CALL dlaln2( ltrans( itrans ), na, nw,
268 $ smin, ca, a, 2, d1, d2, b,
269 $ 2, wr, wi, x, 2, scale,
272 $ ninfo( 1 ) = ninfo( 1 ) + 1
274 $ ninfo( 2 ) = ninfo( 2 ) + 1
275 res = abs( ( ca*a( 1, 1 )-wr*d1 )*
276 $ x( 1, 1 )+( wi*d1 )*x( 1, 2 )-
278 res = res + abs( ( -wi*d1 )*x( 1, 1 )+
279 $ ( ca*a( 1, 1 )-wr*d1 )*x( 1, 2 )-
282 den = max( eps*( max( abs( ca*a( 1,
283 $ 1 )-wr*d1 ), abs( d1*wi ) )*
284 $ ( abs( x( 1, 1 ) )+abs( x( 1,
285 $ 2 ) ) ) ), smlnum )
287 den = max( smin*( abs( x( 1,
288 $ 1 ) )+abs( x( 1, 2 ) ) ),
292 IF( abs( x( 1, 1 ) ).LT.unfl .AND.
293 $ abs( x( 1, 2 ) ).LT.unfl .AND.
294 $ abs( b( 1, 1 ) ).LE.smlnum*
295 $ abs( ca*a( 1, 1 )-wr*d1 ) )
298 $ res = res + one / eps
299 res = res + abs( xnorm-
301 $ abs( x( 1, 2 ) ) ) /
302 $ max( smlnum, xnorm ) / eps
303 IF( info.NE.0 .AND. info.NE.1 )
304 $ res = res + one / eps
306 IF( res.GT.rmax )
THEN
318 a( 1, 1 ) = vab( ia )
319 a( 1, 2 ) = -three*vab( ia )
320 a( 2, 1 ) = -seven*vab( ia )
321 a( 2, 2 ) = twnone*vab( ia )
323 b( 1, 1 ) = vab( ib )
324 b( 2, 1 ) = -two*vab( ib )
326 IF( d1.EQ.one .AND. d2.EQ.one .AND. ca.EQ.
328 wr = vwr( iwr )*a( 1, 1 )
333 CALL dlaln2( ltrans( itrans ), na, nw,
334 $ smin, ca, a, 2, d1, d2, b, 2,
335 $ wr, wi, x, 2, scale, xnorm,
338 $ ninfo( 1 ) = ninfo( 1 ) + 1
340 $ ninfo( 2 ) = ninfo( 2 ) + 1
341 IF( itrans.EQ.1 )
THEN
343 a( 1, 2 ) = a( 2, 1 )
346 res = abs( ( ca*a( 1, 1 )-wr*d1 )*
347 $ x( 1, 1 )+( ca*a( 1, 2 ) )*
348 $ x( 2, 1 )-scale*b( 1, 1 ) )
349 res = res + abs( ( ca*a( 2, 1 ) )*
350 $ x( 1, 1 )+( ca*a( 2, 2 )-wr*d2 )*
351 $ x( 2, 1 )-scale*b( 2, 1 ) )
353 den = max( eps*( max( abs( ca*a( 1,
354 $ 1 )-wr*d1 )+abs( ca*a( 1, 2 ) ),
355 $ abs( ca*a( 2, 1 ) )+abs( ca*a( 2,
356 $ 2 )-wr*d2 ) )*max( abs( x( 1,
357 $ 1 ) ), abs( x( 2, 1 ) ) ) ),
360 den = max( eps*( max( smin / eps,
362 $ 1 )-wr*d1 )+abs( ca*a( 1, 2 ) ),
363 $ abs( ca*a( 2, 1 ) )+abs( ca*a( 2,
364 $ 2 )-wr*d2 ) ) )*max( abs( x( 1,
365 $ 1 ) ), abs( x( 2, 1 ) ) ) ),
369 IF( abs( x( 1, 1 ) ).LT.unfl .AND.
370 $ abs( x( 2, 1 ) ).LT.unfl .AND.
371 $ abs( b( 1, 1 ) )+abs( b( 2, 1 ) ).LE.
372 $ smlnum*( abs( ca*a( 1,
373 $ 1 )-wr*d1 )+abs( ca*a( 1,
374 $ 2 ) )+abs( ca*a( 2,
375 $ 1 ) )+abs( ca*a( 2, 2 )-wr*d2 ) ) )
378 $ res = res + one / eps
379 res = res + abs( xnorm-
380 $ max( abs( x( 1, 1 ) ), abs( x( 2,
381 $ 1 ) ) ) ) / max( smlnum, xnorm ) /
383 IF( info.NE.0 .AND. info.NE.1 )
384 $ res = res + one / eps
386 IF( res.GT.rmax )
THEN
397 a( 1, 1 ) = vab( ia )*two
398 a( 1, 2 ) = -three*vab( ia )
399 a( 2, 1 ) = -seven*vab( ia )
400 a( 2, 2 ) = twnone*vab( ia )
402 b( 1, 1 ) = vab( ib )
403 b( 2, 1 ) = -two*vab( ib )
404 b( 1, 2 ) = four*vab( ib )
405 b( 2, 2 ) = -seven*vab( ib )
407 IF( d1.EQ.one .AND. d2.EQ.one .AND. ca.EQ.
409 wr = vwr( iwr )*a( 1, 1 )
414 IF( d1.EQ.one .AND. d2.EQ.one .AND.
416 wi = vwi( iwi )*a( 1, 1 )
420 CALL dlaln2( ltrans( itrans ), na, nw,
421 $ smin, ca, a, 2, d1, d2, b,
422 $ 2, wr, wi, x, 2, scale,
425 $ ninfo( 1 ) = ninfo( 1 ) + 1
427 $ ninfo( 2 ) = ninfo( 2 ) + 1
428 IF( itrans.EQ.1 )
THEN
430 a( 1, 2 ) = a( 2, 1 )
433 res = abs( ( ca*a( 1, 1 )-wr*d1 )*
434 $ x( 1, 1 )+( ca*a( 1, 2 ) )*
435 $ x( 2, 1 )+( wi*d1 )*x( 1, 2 )-
437 res = res + abs( ( ca*a( 1,
438 $ 1 )-wr*d1 )*x( 1, 2 )+
439 $ ( ca*a( 1, 2 ) )*x( 2, 2 )-
440 $ ( wi*d1 )*x( 1, 1 )-scale*
442 res = res + abs( ( ca*a( 2, 1 ) )*
443 $ x( 1, 1 )+( ca*a( 2, 2 )-wr*d2 )*
444 $ x( 2, 1 )+( wi*d2 )*x( 2, 2 )-
446 res = res + abs( ( ca*a( 2, 1 ) )*
447 $ x( 1, 2 )+( ca*a( 2, 2 )-wr*d2 )*
448 $ x( 2, 2 )-( wi*d2 )*x( 2, 1 )-
451 den = max( eps*( max( abs( ca*a( 1,
452 $ 1 )-wr*d1 )+abs( ca*a( 1,
453 $ 2 ) )+abs( wi*d1 ),
455 $ 1 ) )+abs( ca*a( 2,
456 $ 2 )-wr*d2 )+abs( wi*d2 ) )*
458 $ 1 ) )+abs( x( 2, 1 ) ),
459 $ abs( x( 1, 2 ) )+abs( x( 2,
460 $ 2 ) ) ) ), smlnum )
462 den = max( eps*( max( smin / eps,
464 $ 1 )-wr*d1 )+abs( ca*a( 1,
465 $ 2 ) )+abs( wi*d1 ),
467 $ 1 ) )+abs( ca*a( 2,
468 $ 2 )-wr*d2 )+abs( wi*d2 ) ) )*
470 $ 1 ) )+abs( x( 2, 1 ) ),
471 $ abs( x( 1, 2 ) )+abs( x( 2,
472 $ 2 ) ) ) ), smlnum )
475 IF( abs( x( 1, 1 ) ).LT.unfl .AND.
476 $ abs( x( 2, 1 ) ).LT.unfl .AND.
477 $ abs( x( 1, 2 ) ).LT.unfl .AND.
478 $ abs( x( 2, 2 ) ).LT.unfl .AND.
480 $ abs( b( 2, 1 ) ).LE.smlnum*
481 $ ( abs( ca*a( 1, 1 )-wr*d1 )+
482 $ abs( ca*a( 1, 2 ) )+abs( ca*a( 2,
483 $ 1 ) )+abs( ca*a( 2,
484 $ 2 )-wr*d2 )+abs( wi*d2 )+abs( wi*
487 $ res = res + one / eps
488 res = res + abs( xnorm-
489 $ max( abs( x( 1, 1 ) )+abs( x( 1,
491 $ 1 ) )+abs( x( 2, 2 ) ) ) ) /
492 $ max( smlnum, xnorm ) / eps
493 IF( info.NE.0 .AND. info.NE.1 )
494 $ res = res + one / eps
496 IF( res.GT.rmax )
THEN
subroutine dget31(rmax, lmax, ninfo, knt)
DGET31
subroutine dlaln2(ltrans, na, nw, smin, ca, a, lda, d1, d2, b, ldb, wr, wi, x, ldx, scale, xnorm, info)
DLALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form.