LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine dlae2 ( double precision A, double precision B, double precision C, double precision RT1, double precision RT2 )

DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix.

Download DLAE2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
``` DLAE2  computes the eigenvalues of a 2-by-2 symmetric matrix
[  A   B  ]
[  B   C  ].
On return, RT1 is the eigenvalue of larger absolute value, and RT2
is the eigenvalue of smaller absolute value.```
Parameters
 [in] A ``` A is DOUBLE PRECISION The (1,1) element of the 2-by-2 matrix.``` [in] B ``` B is DOUBLE PRECISION The (1,2) and (2,1) elements of the 2-by-2 matrix.``` [in] C ``` C is DOUBLE PRECISION The (2,2) element of the 2-by-2 matrix.``` [out] RT1 ``` RT1 is DOUBLE PRECISION The eigenvalue of larger absolute value.``` [out] RT2 ``` RT2 is DOUBLE PRECISION The eigenvalue of smaller absolute value.```
Date
September 2012
Further Details:
```  RT1 is accurate to a few ulps barring over/underflow.

RT2 may be inaccurate if there is massive cancellation in the
determinant A*C-B*B; higher precision or correctly rounded or
correctly truncated arithmetic would be needed to compute RT2
accurately in all cases.

Overflow is possible only if RT1 is within a factor of 5 of overflow.
Underflow is harmless if the input data is 0 or exceeds
underflow_threshold / macheps.```

Definition at line 104 of file dlae2.f.

104 *
105 * -- LAPACK auxiliary routine (version 3.4.2) --
106 * -- LAPACK is a software package provided by Univ. of Tennessee, --
107 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
108 * September 2012
109 *
110 * .. Scalar Arguments ..
111  DOUBLE PRECISION a, b, c, rt1, rt2
112 * ..
113 *
114 * =====================================================================
115 *
116 * .. Parameters ..
117  DOUBLE PRECISION one
118  parameter ( one = 1.0d0 )
119  DOUBLE PRECISION two
120  parameter ( two = 2.0d0 )
121  DOUBLE PRECISION zero
122  parameter ( zero = 0.0d0 )
123  DOUBLE PRECISION half
124  parameter ( half = 0.5d0 )
125 * ..
126 * .. Local Scalars ..
127  DOUBLE PRECISION ab, acmn, acmx, adf, df, rt, sm, tb
128 * ..
129 * .. Intrinsic Functions ..
130  INTRINSIC abs, sqrt
131 * ..
132 * .. Executable Statements ..
133 *
134 * Compute the eigenvalues
135 *
136  sm = a + c
137  df = a - c
138  adf = abs( df )
139  tb = b + b
140  ab = abs( tb )
141  IF( abs( a ).GT.abs( c ) ) THEN
142  acmx = a
143  acmn = c
144  ELSE
145  acmx = c
146  acmn = a
147  END IF
148  IF( adf.GT.ab ) THEN
149  rt = adf*sqrt( one+( ab / adf )**2 )
150  ELSE IF( adf.LT.ab ) THEN
151  rt = ab*sqrt( one+( adf / ab )**2 )
152  ELSE
153 *
154 * Includes case AB=ADF=0
155 *
156  rt = ab*sqrt( two )
157  END IF
158  IF( sm.LT.zero ) THEN
159  rt1 = half*( sm-rt )
160 *
161 * Order of execution important.
162 * To get fully accurate smaller eigenvalue,
163 * next line needs to be executed in higher precision.
164 *
165  rt2 = ( acmx / rt1 )*acmn - ( b / rt1 )*b
166  ELSE IF( sm.GT.zero ) THEN
167  rt1 = half*( sm+rt )
168 *
169 * Order of execution important.
170 * To get fully accurate smaller eigenvalue,
171 * next line needs to be executed in higher precision.
172 *
173  rt2 = ( acmx / rt1 )*acmn - ( b / rt1 )*b
174  ELSE
175 *
176 * Includes case RT1 = RT2 = 0
177 *
178  rt1 = half*rt
179  rt2 = -half*rt
180  END IF
181  RETURN
182 *
183 * End of DLAE2
184 *

Here is the caller graph for this function: