1
*> \brief \b DLAEV2 computes the eigenvalues and eigenvectors of a 2-by-2 symmetric/Hermitian matrix.
3
* =========== DOCUMENTATION ===========
5
* Online html documentation available at
6
* http://www.netlib.org/lapack/explore-html/
9
*> Download DLAEV2 + dependencies
10
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlaev2.f">
12
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlaev2.f">
14
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlaev2.f">
21
* SUBROUTINE DLAEV2( A, B, C, RT1, RT2, CS1, SN1 )
23
* .. Scalar Arguments ..
24
* DOUBLE PRECISION A, B, C, CS1, RT1, RT2, SN1
33
*> DLAEV2 computes the eigendecomposition of a 2-by-2 symmetric matrix
36
*> On return, RT1 is the eigenvalue of larger absolute value, RT2 is the
37
*> eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right
38
*> eigenvector for RT1, giving the decomposition
40
*> [ CS1 SN1 ] [ A B ] [ CS1 -SN1 ] = [ RT1 0 ]
41
*> [-SN1 CS1 ] [ B C ] [ SN1 CS1 ] [ 0 RT2 ].
49
*> A is DOUBLE PRECISION
50
*> The (1,1) element of the 2-by-2 matrix.
55
*> B is DOUBLE PRECISION
56
*> The (1,2) element and the conjugate of the (2,1) element of
62
*> C is DOUBLE PRECISION
63
*> The (2,2) element of the 2-by-2 matrix.
68
*> RT1 is DOUBLE PRECISION
69
*> The eigenvalue of larger absolute value.
74
*> RT2 is DOUBLE PRECISION
75
*> The eigenvalue of smaller absolute value.
80
*> CS1 is DOUBLE PRECISION
85
*> SN1 is DOUBLE PRECISION
86
*> The vector (CS1, SN1) is a unit right eigenvector for RT1.
92
*> \author Univ. of Tennessee
93
*> \author Univ. of California Berkeley
94
*> \author Univ. of Colorado Denver
97
*> \date September 2012
99
*> \ingroup auxOTHERauxiliary
101
*> \par Further Details:
102
* =====================
106
*> RT1 is accurate to a few ulps barring over/underflow.
108
*> RT2 may be inaccurate if there is massive cancellation in the
109
*> determinant A*C-B*B; higher precision or correctly rounded or
110
*> correctly truncated arithmetic would be needed to compute RT2
111
*> accurately in all cases.
113
*> CS1 and SN1 are accurate to a few ulps barring over/underflow.
115
*> Overflow is possible only if RT1 is within a factor of 5 of overflow.
116
*> Underflow is harmless if the input data is 0 or exceeds
117
*> underflow_threshold / macheps.
120
* =====================================================================
121
SUBROUTINE DLAEV2( A, B, C, RT1, RT2, CS1, SN1 )
123
* -- LAPACK auxiliary routine (version 3.4.2) --
124
* -- LAPACK is a software package provided by Univ. of Tennessee, --
125
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128
* .. Scalar Arguments ..
129
DOUBLE PRECISION A, B, C, CS1, RT1, RT2, SN1
132
* =====================================================================
136
PARAMETER ( ONE = 1.0D0 )
138
PARAMETER ( TWO = 2.0D0 )
139
DOUBLE PRECISION ZERO
140
PARAMETER ( ZERO = 0.0D0 )
141
DOUBLE PRECISION HALF
142
PARAMETER ( HALF = 0.5D0 )
144
* .. Local Scalars ..
146
DOUBLE PRECISION AB, ACMN, ACMX, ACS, ADF, CS, CT, DF, RT, SM,
149
* .. Intrinsic Functions ..
152
* .. Executable Statements ..
154
* Compute the eigenvalues
161
IF( ABS( A ).GT.ABS( C ) ) THEN
169
RT = ADF*SQRT( ONE+( AB / ADF )**2 )
170
ELSE IF( ADF.LT.AB ) THEN
171
RT = AB*SQRT( ONE+( ADF / AB )**2 )
174
* Includes case AB=ADF=0
178
IF( SM.LT.ZERO ) THEN
182
* Order of execution important.
183
* To get fully accurate smaller eigenvalue,
184
* next line needs to be executed in higher precision.
186
RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
187
ELSE IF( SM.GT.ZERO ) THEN
191
* Order of execution important.
192
* To get fully accurate smaller eigenvalue,
193
* next line needs to be executed in higher precision.
195
RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
198
* Includes case RT1 = RT2 = 0
205
* Compute the eigenvector
207
IF( DF.GE.ZERO ) THEN
217
SN1 = ONE / SQRT( ONE+CT*CT )
220
IF( AB.EQ.ZERO ) THEN
225
CS1 = ONE / SQRT( ONE+TN*TN )
229
IF( SGN1.EQ.SGN2 ) THEN