1 SUBROUTINE DLAE2( A, B, C, RT1, RT2 )
3 ! -- LAPACK auxiliary routine (version 3.1) --
4 ! Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
7 ! .. Scalar Arguments ..
8 DOUBLE PRECISION A, B, C, RT1, RT2
14 ! DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix
17 ! On return, RT1 is the eigenvalue of larger absolute value, and RT2
18 ! is the eigenvalue of smaller absolute value.
23 ! A (input) DOUBLE PRECISION
24 ! The (1,1) element of the 2-by-2 matrix.
26 ! B (input) DOUBLE PRECISION
27 ! The (1,2) and (2,1) elements of the 2-by-2 matrix.
29 ! C (input) DOUBLE PRECISION
30 ! The (2,2) element of the 2-by-2 matrix.
32 ! RT1 (output) DOUBLE PRECISION
33 ! The eigenvalue of larger absolute value.
35 ! RT2 (output) DOUBLE PRECISION
36 ! The eigenvalue of smaller absolute value.
41 ! RT1 is accurate to a few ulps barring over/underflow.
43 ! RT2 may be inaccurate if there is massive cancellation in the
44 ! determinant A*C-B*B; higher precision or correctly rounded or
45 ! correctly truncated arithmetic would be needed to compute RT2
46 ! accurately in all cases.
48 ! Overflow is possible only if RT1 is within a factor of 5 of overflow.
49 ! Underflow is harmless if the input data is 0 or exceeds
50 ! underflow_threshold / macheps.
52 ! =====================================================================
56 PARAMETER ( ONE = 1.0D0 )
58 PARAMETER ( TWO = 2.0D0 )
60 PARAMETER ( ZERO = 0.0D0 )
62 PARAMETER ( HALF = 0.5D0 )
65 DOUBLE PRECISION AB, ACMN, ACMX, ADF, DF, RT, SM, TB
67 ! .. Intrinsic Functions ..
70 ! .. Executable Statements ..
72 ! Compute the eigenvalues
79 IF( ABS( A ).GT.ABS( C ) ) THEN
87 RT = ADF*SQRT( ONE+( AB / ADF )**2 )
88 ELSE IF( ADF.LT.AB ) THEN
89 RT = AB*SQRT( ONE+( ADF / AB )**2 )
92 ! Includes case AB=ADF=0
99 ! Order of execution important.
100 ! To get fully accurate smaller eigenvalue,
101 ! next line needs to be executed in higher precision.
103 RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
104 ELSE IF( SM.GT.ZERO ) THEN
107 ! Order of execution important.
108 ! To get fully accurate smaller eigenvalue,
109 ! next line needs to be executed in higher precision.
111 RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
114 ! Includes case RT1 = RT2 = 0