LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dlae2()

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.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
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 99 of file dlae2.f.

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