1 *> \brief \b SLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLAE2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slae2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slae2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slae2.f">
21 * SUBROUTINE SLAE2( A, B, C, RT1, RT2 )
23 * .. Scalar Arguments ..
24 * REAL A, B, C, RT1, RT2
33 *> SLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix
36 *> On return, RT1 is the eigenvalue of larger absolute value, and RT2
37 *> is the eigenvalue of smaller absolute value.
46 *> The (1,1) element of the 2-by-2 matrix.
52 *> The (1,2) and (2,1) elements of the 2-by-2 matrix.
58 *> The (2,2) element of the 2-by-2 matrix.
64 *> The eigenvalue of larger absolute value.
70 *> The eigenvalue of smaller absolute value.
76 *> \author Univ. of Tennessee
77 *> \author Univ. of California Berkeley
78 *> \author Univ. of Colorado Denver
81 *> \date September 2012
83 *> \ingroup OTHERauxiliary
85 *> \par Further Details:
86 * =====================
90 *> RT1 is accurate to a few ulps barring over/underflow.
92 *> RT2 may be inaccurate if there is massive cancellation in the
93 *> determinant A*C-B*B; higher precision or correctly rounded or
94 *> correctly truncated arithmetic would be needed to compute RT2
95 *> accurately in all cases.
97 *> Overflow is possible only if RT1 is within a factor of 5 of overflow.
98 *> Underflow is harmless if the input data is 0 or exceeds
99 *> underflow_threshold / macheps.
102 * =====================================================================
103 SUBROUTINE SLAE2( A, B, C, RT1, RT2 )
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..--
110 * .. Scalar Arguments ..
111 REAL A, B, C, RT1, RT2
114 * =====================================================================
118 PARAMETER ( ONE = 1.0E0 )
120 PARAMETER ( TWO = 2.0E0 )
122 PARAMETER ( ZERO = 0.0E0 )
124 PARAMETER ( HALF = 0.5E0 )
126 * .. Local Scalars ..
127 REAL AB, ACMN, ACMX, ADF, DF, RT, SM, TB
129 * .. Intrinsic Functions ..
132 * .. Executable Statements ..
134 * Compute the eigenvalues
141 IF( ABS( A ).GT.ABS( C ) ) THEN
149 RT = ADF*SQRT( ONE+( AB / ADF )**2 )
150 ELSE IF( ADF.LT.AB ) THEN
151 RT = AB*SQRT( ONE+( ADF / AB )**2 )
154 * Includes case AB=ADF=0
158 IF( SM.LT.ZERO ) THEN
161 * Order of execution important.
162 * To get fully accurate smaller eigenvalue,
163 * next line needs to be executed in higher precision.
165 RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
166 ELSE IF( SM.GT.ZERO ) THEN
169 * Order of execution important.
170 * To get fully accurate smaller eigenvalue,
171 * next line needs to be executed in higher precision.
173 RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
176 * Includes case RT1 = RT2 = 0