slagv2.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>slagv2.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="SLAGV2.1"></a><a href="slagv2.f.html#SLAGV2.1">SLAGV2</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
      REAL               CSL, CSR, SNL, SNR
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      REAL               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="SLAGV2.20"></a><a href="slagv2.f.html#SLAGV2.1">SLAGV2</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 &gt;= b22 &gt; 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) REAL 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 &gt;= 2.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  B       (input/output) REAL 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 &gt;= 2.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ALPHAR  (output) REAL array, dimension (2)
</span><span class="comment">*</span><span class="comment">  ALPHAI  (output) REAL array, dimension (2)
</span><span class="comment">*</span><span class="comment">  BETA    (output) REAL 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) REAL
</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) REAL
</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) REAL
</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) REAL
</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>      REAL               ZERO, ONE
      PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      REAL               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="SLAG2.102"></a><a href="slag2.f.html#SLAG2.1">SLAG2</a>, <a name="SLARTG.102"></a><a href="slartg.f.html#SLARTG.1">SLARTG</a>, <a name="SLASV2.102"></a><a href="slasv2.f.html#SLASV2.1">SLASV2</a>, SROT
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      REAL               <a name="SLAMCH.105"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLAPY2.105"></a><a href="slapy2.f.html#SLAPY2.1">SLAPY2</a>
      EXTERNAL           <a name="SLAMCH.106"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLAPY2.106"></a><a href="slapy2.f.html#SLAPY2.1">SLAPY2</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="SLAMCH.113"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'S'</span> )
      ULP = <a name="SLAMCH.114"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</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 + -
显示快捷键?