KTH framework for Nek5000 toolboxes; testing version  0.0.1
dlae2.f
Go to the documentation of this file.
1  SUBROUTINE dlae2( A, B, C, RT1, RT2 )
2 *
3 * -- LAPACK auxiliary routine (version 3.0) --
4 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5 * Courant Institute, Argonne National Lab, and Rice University
6 * October 31, 1992
7 *
8 * .. Scalar Arguments ..
9  DOUBLE PRECISION A, B, C, RT1, RT2
10 * ..
11 *
12 * Purpose
13 * =======
14 *
15 * DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix
16 * [ A B ]
17 * [ B C ].
18 * On return, RT1 is the eigenvalue of larger absolute value, and RT2
19 * is the eigenvalue of smaller absolute value.
20 *
21 * Arguments
22 * =========
23 *
24 * A (input) DOUBLE PRECISION
25 * The (1,1) element of the 2-by-2 matrix.
26 *
27 * B (input) DOUBLE PRECISION
28 * The (1,2) and (2,1) elements of the 2-by-2 matrix.
29 *
30 * C (input) DOUBLE PRECISION
31 * The (2,2) element of the 2-by-2 matrix.
32 *
33 * RT1 (output) DOUBLE PRECISION
34 * The eigenvalue of larger absolute value.
35 *
36 * RT2 (output) DOUBLE PRECISION
37 * The eigenvalue of smaller absolute value.
38 *
39 * Further Details
40 * ===============
41 *
42 * RT1 is accurate to a few ulps barring over/underflow.
43 *
44 * RT2 may be inaccurate if there is massive cancellation in the
45 * determinant A*C-B*B; higher precision or correctly rounded or
46 * correctly truncated arithmetic would be needed to compute RT2
47 * accurately in all cases.
48 *
49 * Overflow is possible only if RT1 is within a factor of 5 of overflow.
50 * Underflow is harmless if the input data is 0 or exceeds
51 * underflow_threshold / macheps.
52 *
53 * =====================================================================
54 *
55 * .. Parameters ..
56  DOUBLE PRECISION ONE
57  parameter( one = 1.0d0 )
58  DOUBLE PRECISION TWO
59  parameter( two = 2.0d0 )
60  DOUBLE PRECISION ZERO
61  parameter( zero = 0.0d0 )
62  DOUBLE PRECISION HALF
63  parameter( half = 0.5d0 )
64 * ..
65 * .. Local Scalars ..
66  DOUBLE PRECISION AB, ACMN, ACMX, ADF, DF, RT, SM, TB
67 * ..
68 * .. Intrinsic Functions ..
69  INTRINSIC abs, sqrt
70 * ..
71 * .. Executable Statements ..
72 *
73 * Compute the eigenvalues
74 *
75  sm = a + c
76  df = a - c
77  adf = abs( df )
78  tb = b + b
79  ab = abs( tb )
80  IF( abs( a ).GT.abs( c ) ) THEN
81  acmx = a
82  acmn = c
83  ELSE
84  acmx = c
85  acmn = a
86  END IF
87  IF( adf.GT.ab ) THEN
88  rt = adf*sqrt( one+( ab / adf )**2 )
89  ELSE IF( adf.LT.ab ) THEN
90  rt = ab*sqrt( one+( adf / ab )**2 )
91  ELSE
92 *
93 * Includes case AB=ADF=0
94 *
95  rt = ab*sqrt( two )
96  END IF
97  IF( sm.LT.zero ) THEN
98  rt1 = half*( sm-rt )
99 *
100 * Order of execution important.
101 * To get fully accurate smaller eigenvalue,
102 * next line needs to be executed in higher precision.
103 *
104  rt2 = ( acmx / rt1 )*acmn - ( b / rt1 )*b
105  ELSE IF( sm.GT.zero ) THEN
106  rt1 = half*( sm+rt )
107 *
108 * Order of execution important.
109 * To get fully accurate smaller eigenvalue,
110 * next line needs to be executed in higher precision.
111 *
112  rt2 = ( acmx / rt1 )*acmn - ( b / rt1 )*b
113  ELSE
114 *
115 * Includes case RT1 = RT2 = 0
116 *
117  rt1 = half*rt
118  rt2 = -half*rt
119  END IF
120  RETURN
121 *
122 * End of DLAE2
123 *
124  END
subroutine dlae2(A, B, C, RT1, RT2)
Definition: dlae2.f:2