 LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ slae2()

 subroutine slae2 ( real A, real B, real C, real RT1, real RT2 )

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

Purpose:
``` SLAE2  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 REAL The (1,1) element of the 2-by-2 matrix.``` [in] B ``` B is REAL The (1,2) and (2,1) elements of the 2-by-2 matrix.``` [in] C ``` C is REAL The (2,2) element of the 2-by-2 matrix.``` [out] RT1 ``` RT1 is REAL The eigenvalue of larger absolute value.``` [out] RT2 ``` RT2 is REAL The eigenvalue of smaller absolute value.```
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 101 of file slae2.f.

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