LAPACK 3.12.0
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 101 of file dlae2.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 DOUBLE PRECISION A, B, C, RT1, RT2
109* ..
110*
111* =====================================================================
112*
113* .. Parameters ..
114 DOUBLE PRECISION ONE
115 parameter( one = 1.0d0 )
116 DOUBLE PRECISION TWO
117 parameter( two = 2.0d0 )
118 DOUBLE PRECISION ZERO
119 parameter( zero = 0.0d0 )
120 DOUBLE PRECISION HALF
121 parameter( half = 0.5d0 )
122* ..
123* .. Local Scalars ..
124 DOUBLE PRECISION 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
145 IF( adf.GT.ab ) THEN
146 rt = adf*sqrt( one+( ab / adf )**2 )
147 ELSE IF( adf.LT.ab ) THEN
148 rt = ab*sqrt( one+( adf / ab )**2 )
149 ELSE
150*
151* Includes case AB=ADF=0
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 DLAE2
181*
Here is the caller graph for this function: