zlar1v.f.html

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

HTML
396
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>zlar1v.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="ZLAR1V.1"></a><a href="zlar1v.f.html#ZLAR1V.1">ZLAR1V</a>( N, B1, BN, LAMBDA, D, L, LD, LLD,
     $           PIVMIN, GAPTOL, Z, WANTNC, NEGCNT, ZTZ, MINGMA,
     $           R, ISUPPZ, NRMINV, RESID, RQCORR, WORK )
<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>      LOGICAL            WANTNC
      INTEGER   B1, BN, N, NEGCNT, R
      DOUBLE PRECISION   GAPTOL, LAMBDA, MINGMA, NRMINV, PIVMIN, RESID,
     $                   RQCORR, ZTZ
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      INTEGER            ISUPPZ( * )
      DOUBLE PRECISION   D( * ), L( * ), LD( * ), LLD( * ),
     $                  WORK( * )
      COMPLEX*16       Z( * )
<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="ZLAR1V.25"></a><a href="zlar1v.f.html#ZLAR1V.1">ZLAR1V</a> computes the (scaled) r-th column of the inverse of
</span><span class="comment">*</span><span class="comment">  the sumbmatrix in rows B1 through BN of the tridiagonal matrix
</span><span class="comment">*</span><span class="comment">  L D L^T - sigma I. When sigma is close to an eigenvalue, the
</span><span class="comment">*</span><span class="comment">  computed vector is an accurate eigenvector. Usually, r corresponds
</span><span class="comment">*</span><span class="comment">  to the index where the eigenvector is largest in magnitude.
</span><span class="comment">*</span><span class="comment">  The following steps accomplish this computation :
</span><span class="comment">*</span><span class="comment">  (a) Stationary qd transform,  L D L^T - sigma I = L(+) D(+) L(+)^T,
</span><span class="comment">*</span><span class="comment">  (b) Progressive qd transform, L D L^T - sigma I = U(-) D(-) U(-)^T,
</span><span class="comment">*</span><span class="comment">  (c) Computation of the diagonal elements of the inverse of
</span><span class="comment">*</span><span class="comment">      L D L^T - sigma I by combining the above transforms, and choosing
</span><span class="comment">*</span><span class="comment">      r as the index where the diagonal of the inverse is (one of the)
</span><span class="comment">*</span><span class="comment">      largest in magnitude.
</span><span class="comment">*</span><span class="comment">  (d) Computation of the (scaled) r-th column of the inverse using the
</span><span class="comment">*</span><span class="comment">      twisted factorization obtained by combining the top part of the
</span><span class="comment">*</span><span class="comment">      the stationary and the bottom part of the progressive transform.
</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">  N        (input) INTEGER
</span><span class="comment">*</span><span class="comment">           The order of the matrix L D L^T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  B1       (input) INTEGER
</span><span class="comment">*</span><span class="comment">           First index of the submatrix of L D L^T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  BN       (input) INTEGER
</span><span class="comment">*</span><span class="comment">           Last index of the submatrix of L D L^T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LAMBDA    (input) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           The shift. In order to compute an accurate eigenvector,
</span><span class="comment">*</span><span class="comment">           LAMBDA should be a good approximation to an eigenvalue
</span><span class="comment">*</span><span class="comment">           of L D L^T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  L        (input) DOUBLE PRECISION array, dimension (N-1)
</span><span class="comment">*</span><span class="comment">           The (n-1) subdiagonal elements of the unit bidiagonal matrix
</span><span class="comment">*</span><span class="comment">           L, in elements 1 to N-1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  D        (input) DOUBLE PRECISION array, dimension (N)
</span><span class="comment">*</span><span class="comment">           The n diagonal elements of the diagonal matrix D.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LD       (input) DOUBLE PRECISION array, dimension (N-1)
</span><span class="comment">*</span><span class="comment">           The n-1 elements L(i)*D(i).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LLD      (input) DOUBLE PRECISION array, dimension (N-1)
</span><span class="comment">*</span><span class="comment">           The n-1 elements L(i)*L(i)*D(i).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  PIVMIN   (input) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           The minimum pivot in the Sturm sequence.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  GAPTOL   (input) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           Tolerance that indicates when eigenvector entries are negligible
</span><span class="comment">*</span><span class="comment">           w.r.t. their contribution to the residual.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Z        (input/output) COMPLEX*16       array, dimension (N)
</span><span class="comment">*</span><span class="comment">           On input, all entries of Z must be set to 0.
</span><span class="comment">*</span><span class="comment">           On output, Z contains the (scaled) r-th column of the
</span><span class="comment">*</span><span class="comment">           inverse. The scaling is such that Z(R) equals 1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WANTNC   (input) LOGICAL
</span><span class="comment">*</span><span class="comment">           Specifies whether NEGCNT has to be computed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  NEGCNT   (output) INTEGER
</span><span class="comment">*</span><span class="comment">           If WANTNC is .TRUE. then NEGCNT = the number of pivots &lt; pivmin
</span><span class="comment">*</span><span class="comment">           in the  matrix factorization L D L^T, and NEGCNT = -1 otherwise.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ZTZ      (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           The square of the 2-norm of Z.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  MINGMA   (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           The reciprocal of the largest (in magnitude) diagonal
</span><span class="comment">*</span><span class="comment">           element of the inverse of L D L^T - sigma I.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  R        (input/output) INTEGER
</span><span class="comment">*</span><span class="comment">           The twist index for the twisted factorization used to
</span><span class="comment">*</span><span class="comment">           compute Z.
</span><span class="comment">*</span><span class="comment">           On input, 0 &lt;= R &lt;= N. If R is input as 0, R is set to
</span><span class="comment">*</span><span class="comment">           the index where (L D L^T - sigma I)^{-1} is largest
</span><span class="comment">*</span><span class="comment">           in magnitude. If 1 &lt;= R &lt;= N, R is unchanged.
</span><span class="comment">*</span><span class="comment">           On output, R contains the twist index used to compute Z.
</span><span class="comment">*</span><span class="comment">           Ideally, R designates the position of the maximum entry in the
</span><span class="comment">*</span><span class="comment">           eigenvector.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ISUPPZ   (output) INTEGER array, dimension (2)
</span><span class="comment">*</span><span class="comment">           The support of the vector in Z, i.e., the vector Z is
</span><span class="comment">*</span><span class="comment">           nonzero only in elements ISUPPZ(1) through ISUPPZ( 2 ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  NRMINV   (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           NRMINV = 1/SQRT( ZTZ )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  RESID    (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           The residual of the FP vector.
</span><span class="comment">*</span><span class="comment">           RESID = ABS( MINGMA )/SQRT( ZTZ )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  RQCORR   (output) DOUBLE PRECISION
</span><span class="comment">*</span><span class="comment">           The Rayleigh Quotient correction to LAMBDA.
</span><span class="comment">*</span><span class="comment">           RQCORR = MINGMA*TMP
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK     (workspace) DOUBLE PRECISION array, dimension (4*N)
</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">     Beresford Parlett, University of California, Berkeley, USA
</span><span class="comment">*</span><span class="comment">     Jim Demmel, University of California, Berkeley, USA
</span><span class="comment">*</span><span class="comment">     Inderjit Dhillon, University of Texas, Austin, USA
</span><span class="comment">*</span><span class="comment">     Osni Marques, LBNL/NERSC, USA
</span><span class="comment">*</span><span class="comment">     Christof Voemel, University of California, Berkeley, 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.0D0, ONE = 1.0D0 )
      COMPLEX*16         CONE
      PARAMETER          ( CONE = ( 1.0D0, 0.0D0 ) )

<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      LOGICAL            SAWNAN1, SAWNAN2
      INTEGER            I, INDLPL, INDP, INDS, INDUMN, NEG1, NEG2, R1,
     $                   R2
      DOUBLE PRECISION   DMINUS, DPLUS, EPS, S, TMP
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL <a name="DISNAN.150"></a><a href="disnan.f.html#DISNAN.1">DISNAN</a>
      DOUBLE PRECISION   <a name="DLAMCH.151"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>
      EXTERNAL           <a name="DISNAN.152"></a><a href="disnan.f.html#DISNAN.1">DISNAN</a>, <a name="DLAMCH.152"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          ABS, DBLE
<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.159"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'Precision'</span> )


      IF( R.EQ.0 ) THEN
         R1 = B1
         R2 = BN
      ELSE
         R1 = R
         R2 = R
      END IF

<span class="comment">*</span><span class="comment">     Storage for LPLUS
</span>      INDLPL = 0
<span class="comment">*</span><span class="comment">     Storage for UMINUS
</span>      INDUMN = N
      INDS = 2*N + 1
      INDP = 3*N + 1

      IF( B1.EQ.1 ) THEN
         WORK( INDS ) = ZERO
      ELSE

⌨️ 快捷键说明

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