📄 dlanv2.f.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dlanv2.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="DLANV2.1"></a><a href="dlanv2.f.html#DLANV2.1">DLANV2</a>( A, B, C, D, RT1R, RT1I, RT2R, RT2I, CS, SN )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK driver routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> DOUBLE PRECISION A, B, C, CS, D, RT1I, RT1R, RT2I, RT2R, SN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="DLANV2.14"></a><a href="dlanv2.f.html#DLANV2.1">DLANV2</a> computes the Schur factorization of a real 2-by-2 nonsymmetric
</span><span class="comment">*</span><span class="comment"> matrix in standard form:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> [ A B ] = [ CS -SN ] [ AA BB ] [ CS SN ]
</span><span class="comment">*</span><span class="comment"> [ C D ] [ SN CS ] [ CC DD ] [-SN CS ]
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where either
</span><span class="comment">*</span><span class="comment"> 1) CC = 0 so that AA and DD are real eigenvalues of the matrix, or
</span><span class="comment">*</span><span class="comment"> 2) AA = DD and BB*CC < 0, so that AA + or - sqrt(BB*CC) are complex
</span><span class="comment">*</span><span class="comment"> conjugate eigenvalues.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A (input/output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> B (input/output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> C (input/output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> D (input/output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> On entry, the elements of the input matrix.
</span><span class="comment">*</span><span class="comment"> On exit, they are overwritten by the elements of the
</span><span class="comment">*</span><span class="comment"> standardised Schur form.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RT1R (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> RT1I (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> RT2R (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> RT2I (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> The real and imaginary parts of the eigenvalues. If the
</span><span class="comment">*</span><span class="comment"> eigenvalues are a complex conjugate pair, RT1I > 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> CS (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> SN (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> Parameters of the rotation matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Further Details
</span><span class="comment">*</span><span class="comment"> ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Modified by V. Sima, Research Institute for Informatics, Bucharest,
</span><span class="comment">*</span><span class="comment"> Romania, to reduce the risk of cancellation errors,
</span><span class="comment">*</span><span class="comment"> when computing real eigenvalues, and to ensure, if possible, that
</span><span class="comment">*</span><span class="comment"> abs(RT1R) >= abs(RT2R).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> DOUBLE PRECISION ZERO, HALF, ONE
PARAMETER ( ZERO = 0.0D+0, HALF = 0.5D+0, ONE = 1.0D+0 )
DOUBLE PRECISION MULTPL
PARAMETER ( MULTPL = 4.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> DOUBLE PRECISION AA, BB, BCMAX, BCMIS, CC, CS1, DD, EPS, P, SAB,
$ SAC, SCALE, SIGMA, SN1, TAU, TEMP, Z
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> DOUBLE PRECISION <a name="DLAMCH.68"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>, <a name="DLAPY2.68"></a><a href="dlapy2.f.html#DLAPY2.1">DLAPY2</a>
EXTERNAL <a name="DLAMCH.69"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>, <a name="DLAPY2.69"></a><a href="dlapy2.f.html#DLAPY2.1">DLAPY2</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, MAX, MIN, SIGN, SQRT
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span> EPS = <a name="DLAMCH.76"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'P'</span> )
IF( C.EQ.ZERO ) THEN
CS = ONE
SN = ZERO
GO TO 10
<span class="comment">*</span><span class="comment">
</span> ELSE IF( B.EQ.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Swap rows and columns
</span><span class="comment">*</span><span class="comment">
</span> CS = ZERO
SN = ONE
TEMP = D
D = A
A = TEMP
B = -C
C = ZERO
GO TO 10
ELSE IF( ( A-D ).EQ.ZERO .AND. SIGN( ONE, B ).NE.SIGN( ONE, C ) )
$ THEN
CS = ONE
SN = ZERO
GO TO 10
ELSE
<span class="comment">*</span><span class="comment">
</span> TEMP = A - D
P = HALF*TEMP
BCMAX = MAX( ABS( B ), ABS( C ) )
BCMIS = MIN( ABS( B ), ABS( C ) )*SIGN( ONE, B )*SIGN( ONE, C )
SCALE = MAX( ABS( P ), BCMAX )
Z = ( P / SCALE )*P + ( BCMAX / SCALE )*BCMIS
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If Z is of the order of the machine accuracy, postpone the
</span><span class="comment">*</span><span class="comment"> decision on the nature of eigenvalues
</span><span class="comment">*</span><span class="comment">
</span> IF( Z.GE.MULTPL*EPS ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Real eigenvalues. Compute A and D.
</span><span class="comment">*</span><span class="comment">
</span> Z = P + SIGN( SQRT( SCALE )*SQRT( Z ), P )
A = D + Z
D = D - ( BCMAX / Z )*BCMIS
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute B and the rotation matrix
</span><span class="comment">*</span><span class="comment">
</span> TAU = <a name="DLAPY2.121"></a><a href="dlapy2.f.html#DLAPY2.1">DLAPY2</a>( C, Z )
CS = Z / TAU
SN = C / TAU
B = B - C
C = ZERO
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Complex eigenvalues, or real (almost) equal eigenvalues.
</span><span class="comment">*</span><span class="comment"> Make diagonal elements equal.
</span><span class="comment">*</span><span class="comment">
</span> SIGMA = B + C
TAU = <a name="DLAPY2.132"></a><a href="dlapy2.f.html#DLAPY2.1">DLAPY2</a>( SIGMA, TEMP )
CS = SQRT( HALF*( ONE+ABS( SIGMA ) / TAU ) )
SN = -( P / ( TAU*CS ) )*SIGN( ONE, SIGMA )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute [ AA BB ] = [ A B ] [ CS -SN ]
</span><span class="comment">*</span><span class="comment"> [ CC DD ] [ C D ] [ SN CS ]
</span><span class="comment">*</span><span class="comment">
</span> AA = A*CS + B*SN
BB = -A*SN + B*CS
CC = C*CS + D*SN
DD = -C*SN + D*CS
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute [ A B ] = [ CS SN ] [ AA BB ]
</span><span class="comment">*</span><span class="comment"> [ C D ] [-SN CS ] [ CC DD ]
</span><span class="comment">*</span><span class="comment">
</span> A = AA*CS + CC*SN
B = BB*CS + DD*SN
C = -AA*SN + CC*CS
D = -BB*SN + DD*CS
<span class="comment">*</span><span class="comment">
</span> TEMP = HALF*( A+D )
A = TEMP
D = TEMP
<span class="comment">*</span><span class="comment">
</span> IF( C.NE.ZERO ) THEN
IF( B.NE.ZERO ) THEN
IF( SIGN( ONE, B ).EQ.SIGN( ONE, C ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Real eigenvalues: reduce to upper triangular form
</span><span class="comment">*</span><span class="comment">
</span> SAB = SQRT( ABS( B ) )
SAC = SQRT( ABS( C ) )
P = SIGN( SAB*SAC, C )
TAU = ONE / SQRT( ABS( B+C ) )
A = TEMP + P
D = TEMP - P
B = B - C
C = ZERO
CS1 = SAB*TAU
SN1 = SAC*TAU
TEMP = CS*CS1 - SN*SN1
SN = CS*SN1 + SN*CS1
CS = TEMP
END IF
ELSE
B = -C
C = ZERO
TEMP = CS
CS = -SN
SN = TEMP
END IF
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> END IF
<span class="comment">*</span><span class="comment">
</span> 10 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Store eigenvalues in (RT1R,RT1I) and (RT2R,RT2I).
</span><span class="comment">*</span><span class="comment">
</span> RT1R = A
RT2R = D
IF( C.EQ.ZERO ) THEN
RT1I = ZERO
RT2I = ZERO
ELSE
RT1I = SQRT( ABS( B ) )*SQRT( ABS( C ) )
RT2I = -RT1I
END IF
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="DLANV2.203"></a><a href="dlanv2.f.html#DLANV2.1">DLANV2</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -