dlagv2.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 312 行 · 第 1/2 页
HTML
312 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dlagv2.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="DLAGV2.1"></a><a href="dlagv2.f.html#DLAGV2.1">DLAGV2</a>( A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, CSL, SNL,
$ CSR, SNR )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK auxiliary 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> INTEGER LDA, LDB
DOUBLE PRECISION CSL, CSR, SNL, SNR
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> DOUBLE PRECISION A( LDA, * ), ALPHAI( 2 ), ALPHAR( 2 ),
$ B( LDB, * ), BETA( 2 )
<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="DLAGV2.20"></a><a href="dlagv2.f.html#DLAGV2.1">DLAGV2</a> computes the Generalized Schur factorization of a real 2-by-2
</span><span class="comment">*</span><span class="comment"> matrix pencil (A,B) where B is upper triangular. This routine
</span><span class="comment">*</span><span class="comment"> computes orthogonal (rotation) matrices given by CSL, SNL and CSR,
</span><span class="comment">*</span><span class="comment"> SNR such that
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> 1) if the pencil (A,B) has two real eigenvalues (include 0/0 or 1/0
</span><span class="comment">*</span><span class="comment"> types), then
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> [ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
</span><span class="comment">*</span><span class="comment"> [ 0 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> [ b11 b12 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
</span><span class="comment">*</span><span class="comment"> [ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ],
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> 2) if the pencil (A,B) has a pair of complex conjugate eigenvalues,
</span><span class="comment">*</span><span class="comment"> then
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> [ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
</span><span class="comment">*</span><span class="comment"> [ a21 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> [ b11 0 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
</span><span class="comment">*</span><span class="comment"> [ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ]
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where b11 >= b22 > 0.
</span><span class="comment">*</span><span class="comment">
</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 array, dimension (LDA, 2)
</span><span class="comment">*</span><span class="comment"> On entry, the 2 x 2 matrix A.
</span><span class="comment">*</span><span class="comment"> On exit, A is overwritten by the ``A-part'' of the
</span><span class="comment">*</span><span class="comment"> generalized Schur form.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDA (input) INTEGER
</span><span class="comment">*</span><span class="comment"> THe leading dimension of the array A. LDA >= 2.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B (input/output) DOUBLE PRECISION array, dimension (LDB, 2)
</span><span class="comment">*</span><span class="comment"> On entry, the upper triangular 2 x 2 matrix B.
</span><span class="comment">*</span><span class="comment"> On exit, B is overwritten by the ``B-part'' of the
</span><span class="comment">*</span><span class="comment"> generalized Schur form.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> THe leading dimension of the array B. LDB >= 2.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ALPHAR (output) DOUBLE PRECISION array, dimension (2)
</span><span class="comment">*</span><span class="comment"> ALPHAI (output) DOUBLE PRECISION array, dimension (2)
</span><span class="comment">*</span><span class="comment"> BETA (output) DOUBLE PRECISION array, dimension (2)
</span><span class="comment">*</span><span class="comment"> (ALPHAR(k)+i*ALPHAI(k))/BETA(k) are the eigenvalues of the
</span><span class="comment">*</span><span class="comment"> pencil (A,B), k=1,2, i = sqrt(-1). Note that BETA(k) may
</span><span class="comment">*</span><span class="comment"> be zero.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> CSL (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> The cosine of the left rotation matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SNL (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> The sine of the left rotation matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> CSR (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> The cosine of the right rotation matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SNR (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment"> The sine of the right 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"> Based on contributions by
</span><span class="comment">*</span><span class="comment"> Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
</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, ONE
PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> DOUBLE PRECISION ANORM, ASCALE, BNORM, BSCALE, H1, H2, H3, QQ,
$ R, RR, SAFMIN, SCALE1, SCALE2, T, ULP, WI, WR1,
$ WR2
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="DLAG2.102"></a><a href="dlag2.f.html#DLAG2.1">DLAG2</a>, <a name="DLARTG.102"></a><a href="dlartg.f.html#DLARTG.1">DLARTG</a>, <a name="DLASV2.102"></a><a href="dlasv2.f.html#DLASV2.1">DLASV2</a>, DROT
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> DOUBLE PRECISION <a name="DLAMCH.105"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>, <a name="DLAPY2.105"></a><a href="dlapy2.f.html#DLAPY2.1">DLAPY2</a>
EXTERNAL <a name="DLAMCH.106"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>, <a name="DLAPY2.106"></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
<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> SAFMIN = <a name="DLAMCH.113"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'S'</span> )
ULP = <a name="DLAMCH.114"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'P'</span> )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale A
</span><span class="comment">*</span><span class="comment">
</span> ANORM = MAX( ABS( A( 1, 1 ) )+ABS( A( 2, 1 ) ),
$ ABS( A( 1, 2 ) )+ABS( A( 2, 2 ) ), SAFMIN )
ASCALE = ONE / ANORM
A( 1, 1 ) = ASCALE*A( 1, 1 )
A( 1, 2 ) = ASCALE*A( 1, 2 )
A( 2, 1 ) = ASCALE*A( 2, 1 )
A( 2, 2 ) = ASCALE*A( 2, 2 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale B
</span><span class="comment">*</span><span class="comment">
</span> BNORM = MAX( ABS( B( 1, 1 ) ), ABS( B( 1, 2 ) )+ABS( B( 2, 2 ) ),
$ SAFMIN )
BSCALE = ONE / BNORM
B( 1, 1 ) = BSCALE*B( 1, 1 )
B( 1, 2 ) = BSCALE*B( 1, 2 )
B( 2, 2 ) = BSCALE*B( 2, 2 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Check if A can be deflated
</span><span class="comment">*</span><span class="comment">
</span> IF( ABS( A( 2, 1 ) ).LE.ULP ) THEN
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?