dsbgst.f.html

来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 1,028 行 · 第 1/5 页

HTML
1,028
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>dsbgst.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="DSBGST.1"></a><a href="dsbgst.f.html#DSBGST.1">DSBGST</a>( VECT, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, X,
     $                   LDX, WORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK 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>      CHARACTER          UPLO, VECT
      INTEGER            INFO, KA, KB, LDAB, LDBB, LDX, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      DOUBLE PRECISION   AB( LDAB, * ), BB( LDBB, * ), WORK( * ),
     $                   X( LDX, * )
<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="DSBGST.20"></a><a href="dsbgst.f.html#DSBGST.1">DSBGST</a> reduces a real symmetric-definite banded generalized
</span><span class="comment">*</span><span class="comment">  eigenproblem  A*x = lambda*B*x  to standard form  C*y = lambda*y,
</span><span class="comment">*</span><span class="comment">  such that C has the same bandwidth as A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  B must have been previously factorized as S**T*S by <a name="DPBSTF.24"></a><a href="dpbstf.f.html#DPBSTF.1">DPBSTF</a>, using a
</span><span class="comment">*</span><span class="comment">  split Cholesky factorization. A is overwritten by C = X**T*A*X, where
</span><span class="comment">*</span><span class="comment">  X = S**(-1)*Q and Q is an orthogonal matrix chosen to preserve the
</span><span class="comment">*</span><span class="comment">  bandwidth of A.
</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">  VECT    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'N':  do not form the transformation matrix X;
</span><span class="comment">*</span><span class="comment">          = 'V':  form X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  UPLO    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'U':  Upper triangle of A is stored;
</span><span class="comment">*</span><span class="comment">          = 'L':  Lower triangle of A is stored.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The order of the matrices A and B.  N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KA      (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of superdiagonals of the matrix A if UPLO = 'U',
</span><span class="comment">*</span><span class="comment">          or the number of subdiagonals if UPLO = 'L'.  KA &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KB      (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of superdiagonals of the matrix B if UPLO = 'U',
</span><span class="comment">*</span><span class="comment">          or the number of subdiagonals if UPLO = 'L'.  KA &gt;= KB &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  AB      (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
</span><span class="comment">*</span><span class="comment">          On entry, the upper or lower triangle of the symmetric band
</span><span class="comment">*</span><span class="comment">          matrix A, stored in the first ka+1 rows of the array.  The
</span><span class="comment">*</span><span class="comment">          j-th column of A is stored in the j-th column of the array AB
</span><span class="comment">*</span><span class="comment">          as follows:
</span><span class="comment">*</span><span class="comment">          if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)&lt;=i&lt;=j;
</span><span class="comment">*</span><span class="comment">          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j&lt;=i&lt;=min(n,j+ka).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">          On exit, the transformed matrix X**T*A*X, stored in the same
</span><span class="comment">*</span><span class="comment">          format as A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDAB    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array AB.  LDAB &gt;= KA+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  BB      (input) DOUBLE PRECISION array, dimension (LDBB,N)
</span><span class="comment">*</span><span class="comment">          The banded factor S from the split Cholesky factorization of
</span><span class="comment">*</span><span class="comment">          B, as returned by <a name="DPBSTF.67"></a><a href="dpbstf.f.html#DPBSTF.1">DPBSTF</a>, stored in the first KB+1 rows of
</span><span class="comment">*</span><span class="comment">          the array.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDBB    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array BB.  LDBB &gt;= KB+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  X       (output) DOUBLE PRECISION array, dimension (LDX,N)
</span><span class="comment">*</span><span class="comment">          If VECT = 'V', the n-by-n matrix X.
</span><span class="comment">*</span><span class="comment">          If VECT = 'N', the array X is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDX     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array X.
</span><span class="comment">*</span><span class="comment">          LDX &gt;= max(1,N) if VECT = 'V'; LDX &gt;= 1 otherwise.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace) DOUBLE PRECISION array, dimension (2*N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0:  successful exit
</span><span class="comment">*</span><span class="comment">          &lt; 0:  if INFO = -i, the i-th argument had an illegal value.
</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>      LOGICAL            UPDATE, UPPER, WANTX
      INTEGER            I, I0, I1, I2, INCA, J, J1, J1T, J2, J2T, K,
     $                   KA1, KB1, KBT, L, M, NR, NRT, NX
      DOUBLE PRECISION   BII, RA, RA1, T
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL            <a name="LSAME.100"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL           <a name="LSAME.101"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           DGER, <a name="DLAR2V.104"></a><a href="dlar2v.f.html#DLAR2V.1">DLAR2V</a>, <a name="DLARGV.104"></a><a href="dlargv.f.html#DLARGV.1">DLARGV</a>, <a name="DLARTG.104"></a><a href="dlartg.f.html#DLARTG.1">DLARTG</a>, <a name="DLARTV.104"></a><a href="dlartv.f.html#DLARTV.1">DLARTV</a>, <a name="DLASET.104"></a><a href="dlaset.f.html#DLASET.1">DLASET</a>,
     $                   DROT, DSCAL, <a name="XERBLA.105"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          MAX, MIN
<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><span class="comment">*</span><span class="comment">     Test the input parameters
</span><span class="comment">*</span><span class="comment">
</span>      WANTX = <a name="LSAME.114"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'V'</span> )
      UPPER = <a name="LSAME.115"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
      KA1 = KA + 1
      KB1 = KB + 1
      INFO = 0
      IF( .NOT.WANTX .AND. .NOT.<a name="LSAME.119"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'N'</span> ) ) THEN
         INFO = -1
      ELSE IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.121"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
         INFO = -2
      ELSE IF( N.LT.0 ) THEN
         INFO = -3
      ELSE IF( KA.LT.0 ) THEN
         INFO = -4
      ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
         INFO = -5
      ELSE IF( LDAB.LT.KA+1 ) THEN
         INFO = -7
      ELSE IF( LDBB.LT.KB+1 ) THEN
         INFO = -9
      ELSE IF( LDX.LT.1 .OR. WANTX .AND. LDX.LT.MAX( 1, N ) ) THEN
         INFO = -11
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.137"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DSBGST.137"></a><a href="dsbgst.f.html#DSBGST.1">DSBGST</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span>      IF( N.EQ.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span>      INCA = LDAB*KA1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Initialize X to the unit matrix, if needed
</span><span class="comment">*</span><span class="comment">
</span>      IF( WANTX )
     $   CALL <a name="DLASET.151"></a><a href="dlaset.f.html#DLASET.1">DLASET</a>( <span class="string">'Full'</span>, N, N, ZERO, ONE, X, LDX )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Set M to the splitting point m. It must be the same value as is
</span><span class="comment">*</span><span class="comment">     used in <a name="DPBSTF.154"></a><a href="dpbstf.f.html#DPBSTF.1">DPBSTF</a>. The chosen value allows the arrays WORK and RWORK
</span><span class="comment">*</span><span class="comment">     to be of dimension (N).
</span><span class="comment">*</span><span class="comment">
</span>      M = ( N+KB ) / 2
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     The routine works in two phases, corresponding to the two halves
</span><span class="comment">*</span><span class="comment">     of the split Cholesky factorization of B as S**T*S where
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     S = ( U    )
</span><span class="comment">*</span><span class="comment">         ( M  L )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     with U upper triangular of order m, and L lower triangular of
</span><span class="comment">*</span><span class="comment">     order n-m. S has the same bandwidth as B.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     S is treated as a product of elementary matrices:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     S = S(m)*S(m-1)*...*S(2)*S(1)*S(m+1)*S(m+2)*...*S(n-1)*S(n)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     where S(i) is determined by the i-th row of S.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     In phase 1, the index i takes the values n, n-1, ... , m+1;
</span><span class="comment">*</span><span class="comment">     in phase 2, it takes the values 1, 2, ... , m.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     For each value of i, the current matrix A is updated by forming
</span><span class="comment">*</span><span class="comment">     inv(S(i))**T*A*inv(S(i)). This creates a triangular bulge outside
</span><span class="comment">*</span><span class="comment">     the band of A. The bulge is then pushed down toward the bottom of
</span><span class="comment">*</span><span class="comment">     A in phase 1, and up toward the top of A in phase 2, by applying
</span><span class="comment">*</span><span class="comment">     plane rotations.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     There are kb*(kb+1)/2 elements in the bulge, but at most 2*kb-1
</span><span class="comment">*</span><span class="comment">     of them are linearly independent, so annihilating a bulge requires
</span><span class="comment">*</span><span class="comment">     only 2*kb-1 plane rotations. The rotations are divided into a 1st
</span><span class="comment">*</span><span class="comment">     set of kb-1 rotations, and a 2nd set of kb rotations.
</span><span class="comment">*</span><span class="comment">

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?