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

◆ zlaesy()

subroutine zlaesy ( complex*16 a,
complex*16 b,
complex*16 c,
complex*16 rt1,
complex*16 rt2,
complex*16 evscal,
complex*16 cs1,
complex*16 sn1 )

ZLAESY computes the eigenvalues and eigenvectors of a 2-by-2 complex symmetric matrix.

Download ZLAESY + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZLAESY computes the eigendecomposition of a 2-by-2 symmetric matrix
!>    ( ( A, B );( B, C ) )
!> provided the norm of the matrix of eigenvectors is larger than
!> some threshold value.
!>
!> RT1 is the eigenvalue of larger absolute value, and RT2 of
!> smaller absolute value.  If the eigenvectors are computed, then
!> on return ( CS1, SN1 ) is the unit eigenvector for RT1, hence
!>
!> [  CS1     SN1   ] . [ A  B ] . [ CS1    -SN1   ] = [ RT1  0  ]
!> [ -SN1     CS1   ]   [ B  C ]   [ SN1     CS1   ]   [  0  RT2 ]
!> 
Parameters
[in]A
!>          A is COMPLEX*16
!>          The ( 1, 1 ) element of input matrix.
!> 
[in]B
!>          B is COMPLEX*16
!>          The ( 1, 2 ) element of input matrix.  The ( 2, 1 ) element
!>          is also given by B, since the 2-by-2 matrix is symmetric.
!> 
[in]C
!>          C is COMPLEX*16
!>          The ( 2, 2 ) element of input matrix.
!> 
[out]RT1
!>          RT1 is COMPLEX*16
!>          The eigenvalue of larger modulus.
!> 
[out]RT2
!>          RT2 is COMPLEX*16
!>          The eigenvalue of smaller modulus.
!> 
[out]EVSCAL
!>          EVSCAL is COMPLEX*16
!>          The complex value by which the eigenvector matrix was scaled
!>          to make it orthonormal.  If EVSCAL is zero, the eigenvectors
!>          were not computed.  This means one of two things:  the 2-by-2
!>          matrix could not be diagonalized, or the norm of the matrix
!>          of eigenvectors before scaling was larger than the threshold
!>          value THRESH (set below).
!> 
[out]CS1
!>          CS1 is COMPLEX*16
!> 
[out]SN1
!>          SN1 is COMPLEX*16
!>          If EVSCAL .NE. 0,  ( CS1, SN1 ) is the unit right eigenvector
!>          for RT1.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 112 of file zlaesy.f.

113*
114* -- LAPACK auxiliary routine --
115* -- LAPACK is a software package provided by Univ. of Tennessee, --
116* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117*
118* .. Scalar Arguments ..
119 COMPLEX*16 A, B, C, CS1, EVSCAL, RT1, RT2, SN1
120* ..
121*
122* =====================================================================
123*
124* .. Parameters ..
125 DOUBLE PRECISION ZERO
126 parameter( zero = 0.0d0 )
127 DOUBLE PRECISION ONE
128 parameter( one = 1.0d0 )
129 COMPLEX*16 CONE
130 parameter( cone = ( 1.0d0, 0.0d0 ) )
131 DOUBLE PRECISION HALF
132 parameter( half = 0.5d0 )
133 DOUBLE PRECISION THRESH
134 parameter( thresh = 0.1d0 )
135* ..
136* .. Local Scalars ..
137 DOUBLE PRECISION BABS, EVNORM, TABS, Z
138 COMPLEX*16 S, T, TMP
139* ..
140* .. Intrinsic Functions ..
141 INTRINSIC abs, max, sqrt
142* ..
143* .. Executable Statements ..
144*
145*
146* Special case: The matrix is actually diagonal.
147* To avoid divide by zero later, we treat this case separately.
148*
149 IF( abs( b ).EQ.zero ) THEN
150 rt1 = a
151 rt2 = c
152 IF( abs( rt1 ).LT.abs( rt2 ) ) THEN
153 tmp = rt1
154 rt1 = rt2
155 rt2 = tmp
156 cs1 = zero
157 sn1 = one
158 ELSE
159 cs1 = one
160 sn1 = zero
161 END IF
162 ELSE
163*
164* Compute the eigenvalues and eigenvectors.
165* The characteristic equation is
166* lambda **2 - (A+C) lambda + (A*C - B*B)
167* and we solve it using the quadratic formula.
168*
169 s = ( a+c )*half
170 t = ( a-c )*half
171*
172* Take the square root carefully to avoid over/under flow.
173*
174 babs = abs( b )
175 tabs = abs( t )
176 z = max( babs, tabs )
177 IF( z.GT.zero )
178 $ t = z*sqrt( ( t / z )**2+( b / z )**2 )
179*
180* Compute the two eigenvalues. RT1 and RT2 are exchanged
181* if necessary so that RT1 will have the greater magnitude.
182*
183 rt1 = s + t
184 rt2 = s - t
185 IF( abs( rt1 ).LT.abs( rt2 ) ) THEN
186 tmp = rt1
187 rt1 = rt2
188 rt2 = tmp
189 END IF
190*
191* Choose CS1 = 1 and SN1 to satisfy the first equation, then
192* scale the components of this eigenvector so that the matrix
193* of eigenvectors X satisfies X * X**T = I . (No scaling is
194* done if the norm of the eigenvalue matrix is less than THRESH.)
195*
196 sn1 = ( rt1-a ) / b
197 tabs = abs( sn1 )
198 IF( tabs.GT.one ) THEN
199 t = tabs*sqrt( ( one / tabs )**2+( sn1 / tabs )**2 )
200 ELSE
201 t = sqrt( cone+sn1*sn1 )
202 END IF
203 evnorm = abs( t )
204 IF( evnorm.GE.thresh ) THEN
205 evscal = cone / t
206 cs1 = evscal
207 sn1 = sn1*evscal
208 ELSE
209 evscal = zero
210 END IF
211 END IF
212 RETURN
213*
214* End of ZLAESY
215*