LAPACK  3.8.0 LAPACK: Linear Algebra PACKage

## ◆ dlanv2()

 subroutine dlanv2 ( double precision A, double precision B, double precision C, double precision D, double precision RT1R, double precision RT1I, double precision RT2R, double precision RT2I, double precision CS, double precision SN )

DLANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form.

Purpose:
``` DLANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric
matrix in standard form:

[ A  B ] = [ CS -SN ] [ AA  BB ] [ CS  SN ]
[ C  D ]   [ SN  CS ] [ CC  DD ] [-SN  CS ]

where either
1) CC = 0 so that AA and DD are real eigenvalues of the matrix, or
2) AA = DD and BB*CC < 0, so that AA + or - sqrt(BB*CC) are complex
conjugate eigenvalues.```
Parameters
 [in,out] A ` A is DOUBLE PRECISION` [in,out] B ` B is DOUBLE PRECISION` [in,out] C ` C is DOUBLE PRECISION` [in,out] D ``` D is DOUBLE PRECISION On entry, the elements of the input matrix. On exit, they are overwritten by the elements of the standardised Schur form.``` [out] RT1R ` RT1R is DOUBLE PRECISION` [out] RT1I ` RT1I is DOUBLE PRECISION` [out] RT2R ` RT2R is DOUBLE PRECISION` [out] RT2I ``` RT2I is DOUBLE PRECISION The real and imaginary parts of the eigenvalues. If the eigenvalues are a complex conjugate pair, RT1I > 0.``` [out] CS ` CS is DOUBLE PRECISION` [out] SN ``` SN is DOUBLE PRECISION Parameters of the rotation matrix.```
Date
December 2016
Further Details:
```  Modified by V. Sima, Research Institute for Informatics, Bucharest,
Romania, to reduce the risk of cancellation errors,
when computing real eigenvalues, and to ensure, if possible, that
abs(RT1R) >= abs(RT2R).```

Definition at line 129 of file dlanv2.f.

129 *
130 * -- LAPACK auxiliary routine (version 3.7.0) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 * December 2016
134 *
135 * .. Scalar Arguments ..
136  DOUBLE PRECISION a, b, c, cs, d, rt1i, rt1r, rt2i, rt2r, sn
137 * ..
138 *
139 * =====================================================================
140 *
141 * .. Parameters ..
142  DOUBLE PRECISION zero, half, one
143  parameter( zero = 0.0d+0, half = 0.5d+0, one = 1.0d+0 )
144  DOUBLE PRECISION multpl
145  parameter( multpl = 4.0d+0 )
146 * ..
147 * .. Local Scalars ..
148  DOUBLE PRECISION aa, bb, bcmax, bcmis, cc, cs1, dd, eps, p, sab,
149  \$ sac, scale, sigma, sn1, tau, temp, z
150 * ..
151 * .. External Functions ..
152  DOUBLE PRECISION dlamch, dlapy2
153  EXTERNAL dlamch, dlapy2
154 * ..
155 * .. Intrinsic Functions ..
156  INTRINSIC abs, max, min, sign, sqrt
157 * ..
158 * .. Executable Statements ..
159 *
160  eps = dlamch( 'P' )
161  IF( c.EQ.zero ) THEN
162  cs = one
163  sn = zero
164  GO TO 10
165 *
166  ELSE IF( b.EQ.zero ) THEN
167 *
168 * Swap rows and columns
169 *
170  cs = zero
171  sn = one
172  temp = d
173  d = a
174  a = temp
175  b = -c
176  c = zero
177  GO TO 10
178  ELSE IF( ( a-d ).EQ.zero .AND. sign( one, b ).NE.sign( one, c ) )
179  \$ THEN
180  cs = one
181  sn = zero
182  GO TO 10
183  ELSE
184 *
185  temp = a - d
186  p = half*temp
187  bcmax = max( abs( b ), abs( c ) )
188  bcmis = min( abs( b ), abs( c ) )*sign( one, b )*sign( one, c )
189  scale = max( abs( p ), bcmax )
190  z = ( p / scale )*p + ( bcmax / scale )*bcmis
191 *
192 * If Z is of the order of the machine accuracy, postpone the
193 * decision on the nature of eigenvalues
194 *
195  IF( z.GE.multpl*eps ) THEN
196 *
197 * Real eigenvalues. Compute A and D.
198 *
199  z = p + sign( sqrt( scale )*sqrt( z ), p )
200  a = d + z
201  d = d - ( bcmax / z )*bcmis
202 *
203 * Compute B and the rotation matrix
204 *
205  tau = dlapy2( c, z )
206  cs = z / tau
207  sn = c / tau
208  b = b - c
209  c = zero
210  ELSE
211 *
212 * Complex eigenvalues, or real (almost) equal eigenvalues.
213 * Make diagonal elements equal.
214 *
215  sigma = b + c
216  tau = dlapy2( sigma, temp )
217  cs = sqrt( half*( one+abs( sigma ) / tau ) )
218  sn = -( p / ( tau*cs ) )*sign( one, sigma )
219 *
220 * Compute [ AA BB ] = [ A B ] [ CS -SN ]
221 * [ CC DD ] [ C D ] [ SN CS ]
222 *
223  aa = a*cs + b*sn
224  bb = -a*sn + b*cs
225  cc = c*cs + d*sn
226  dd = -c*sn + d*cs
227 *
228 * Compute [ A B ] = [ CS SN ] [ AA BB ]
229 * [ C D ] [-SN CS ] [ CC DD ]
230 *
231  a = aa*cs + cc*sn
232  b = bb*cs + dd*sn
233  c = -aa*sn + cc*cs
234  d = -bb*sn + dd*cs
235 *
236  temp = half*( a+d )
237  a = temp
238  d = temp
239 *
240  IF( c.NE.zero ) THEN
241  IF( b.NE.zero ) THEN
242  IF( sign( one, b ).EQ.sign( one, c ) ) THEN
243 *
244 * Real eigenvalues: reduce to upper triangular form
245 *
246  sab = sqrt( abs( b ) )
247  sac = sqrt( abs( c ) )
248  p = sign( sab*sac, c )
249  tau = one / sqrt( abs( b+c ) )
250  a = temp + p
251  d = temp - p
252  b = b - c
253  c = zero
254  cs1 = sab*tau
255  sn1 = sac*tau
256  temp = cs*cs1 - sn*sn1
257  sn = cs*sn1 + sn*cs1
258  cs = temp
259  END IF
260  ELSE
261  b = -c
262  c = zero
263  temp = cs
264  cs = -sn
265  sn = temp
266  END IF
267  END IF
268  END IF
269 *
270  END IF
271 *
272  10 CONTINUE
273 *
274 * Store eigenvalues in (RT1R,RT1I) and (RT2R,RT2I).
275 *
276  rt1r = a
277  rt2r = d
278  IF( c.EQ.zero ) THEN
279  rt1i = zero
280  rt2i = zero
281  ELSE
282  rt1i = sqrt( abs( b ) )*sqrt( abs( c ) )
283  rt2i = -rt1i
284  END IF
285  RETURN
286 *
287 * End of DLANV2
288 *
double precision function dlapy2(X, Y)
DLAPY2 returns sqrt(x2+y2).
Definition: dlapy2.f:65
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
Here is the caller graph for this function: