csteqr.f.html

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

HTML
528
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>csteqr.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="CSTEQR.1"></a><a href="csteqr.f.html#CSTEQR.1">CSTEQR</a>( COMPZ, N, D, E, Z, LDZ, 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          COMPZ
      INTEGER            INFO, LDZ, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      REAL               D( * ), E( * ), WORK( * )
      COMPLEX            Z( LDZ, * )
<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="CSTEQR.19"></a><a href="csteqr.f.html#CSTEQR.1">CSTEQR</a> computes all eigenvalues and, optionally, eigenvectors of a
</span><span class="comment">*</span><span class="comment">  symmetric tridiagonal matrix using the implicit QL or QR method.
</span><span class="comment">*</span><span class="comment">  The eigenvectors of a full or band complex Hermitian matrix can also
</span><span class="comment">*</span><span class="comment">  be found if <a name="CHETRD.22"></a><a href="chetrd.f.html#CHETRD.1">CHETRD</a> or <a name="CHPTRD.22"></a><a href="chptrd.f.html#CHPTRD.1">CHPTRD</a> or <a name="CHBTRD.22"></a><a href="chbtrd.f.html#CHBTRD.1">CHBTRD</a> has been used to reduce this
</span><span class="comment">*</span><span class="comment">  matrix to tridiagonal form.
</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">  COMPZ   (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'N':  Compute eigenvalues only.
</span><span class="comment">*</span><span class="comment">          = 'V':  Compute eigenvalues and eigenvectors of the original
</span><span class="comment">*</span><span class="comment">                  Hermitian matrix.  On entry, Z must contain the
</span><span class="comment">*</span><span class="comment">                  unitary matrix used to reduce the original matrix
</span><span class="comment">*</span><span class="comment">                  to tridiagonal form.
</span><span class="comment">*</span><span class="comment">          = 'I':  Compute eigenvalues and eigenvectors of the
</span><span class="comment">*</span><span class="comment">                  tridiagonal matrix.  Z is initialized to the identity
</span><span class="comment">*</span><span class="comment">                  matrix.
</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.  N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  D       (input/output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment">          On entry, the diagonal elements of the tridiagonal matrix.
</span><span class="comment">*</span><span class="comment">          On exit, if INFO = 0, the eigenvalues in ascending order.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  E       (input/output) REAL array, dimension (N-1)
</span><span class="comment">*</span><span class="comment">          On entry, the (n-1) subdiagonal elements of the tridiagonal
</span><span class="comment">*</span><span class="comment">          matrix.
</span><span class="comment">*</span><span class="comment">          On exit, E has been destroyed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Z       (input/output) COMPLEX array, dimension (LDZ, N)
</span><span class="comment">*</span><span class="comment">          On entry, if  COMPZ = 'V', then Z contains the unitary
</span><span class="comment">*</span><span class="comment">          matrix used in the reduction to tridiagonal form.
</span><span class="comment">*</span><span class="comment">          On exit, if INFO = 0, then if COMPZ = 'V', Z contains the
</span><span class="comment">*</span><span class="comment">          orthonormal eigenvectors of the original Hermitian matrix,
</span><span class="comment">*</span><span class="comment">          and if COMPZ = 'I', Z contains the orthonormal eigenvectors
</span><span class="comment">*</span><span class="comment">          of the symmetric tridiagonal matrix.
</span><span class="comment">*</span><span class="comment">          If COMPZ = 'N', then Z is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDZ     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array Z.  LDZ &gt;= 1, and if
</span><span class="comment">*</span><span class="comment">          eigenvectors are desired, then  LDZ &gt;= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace) REAL array, dimension (max(1,2*N-2))
</span><span class="comment">*</span><span class="comment">          If COMPZ = 'N', then WORK is not referenced.
</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">          &gt; 0:  the algorithm has failed to find all the eigenvalues in
</span><span class="comment">*</span><span class="comment">                a total of 30*N iterations; if INFO = i, then i
</span><span class="comment">*</span><span class="comment">                elements of E have not converged to zero; on exit, D
</span><span class="comment">*</span><span class="comment">                and E contain the elements of a symmetric tridiagonal
</span><span class="comment">*</span><span class="comment">                matrix which is unitarily similar to the original
</span><span class="comment">*</span><span class="comment">                matrix.
</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, TWO, THREE
      PARAMETER          ( ZERO = 0.0E0, ONE = 1.0E0, TWO = 2.0E0,
     $                   THREE = 3.0E0 )
      COMPLEX            CZERO, CONE
      PARAMETER          ( CZERO = ( 0.0E0, 0.0E0 ),
     $                   CONE = ( 1.0E0, 0.0E0 ) )
      INTEGER            MAXIT
      PARAMETER          ( MAXIT = 30 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            I, ICOMPZ, II, ISCALE, J, JTOT, K, L, L1, LEND,
     $                   LENDM1, LENDP1, LENDSV, LM1, LSV, M, MM, MM1,
     $                   NM1, NMAXIT
      REAL               ANORM, B, C, EPS, EPS2, F, G, P, R, RT1, RT2,
     $                   S, SAFMAX, SAFMIN, SSFMAX, SSFMIN, TST
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL            <a name="LSAME.96"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      REAL               <a name="SLAMCH.97"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANST.97"></a><a href="slanst.f.html#SLANST.1">SLANST</a>, <a name="SLAPY2.97"></a><a href="slapy2.f.html#SLAPY2.1">SLAPY2</a>
      EXTERNAL           <a name="LSAME.98"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="SLAMCH.98"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANST.98"></a><a href="slanst.f.html#SLANST.1">SLANST</a>, <a name="SLAPY2.98"></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">     .. External Subroutines ..
</span>      EXTERNAL           <a name="CLASET.101"></a><a href="claset.f.html#CLASET.1">CLASET</a>, <a name="CLASR.101"></a><a href="clasr.f.html#CLASR.1">CLASR</a>, CSWAP, <a name="SLAE2.101"></a><a href="slae2.f.html#SLAE2.1">SLAE2</a>, <a name="SLAEV2.101"></a><a href="slaev2.f.html#SLAEV2.1">SLAEV2</a>, <a name="SLARTG.101"></a><a href="slartg.f.html#SLARTG.1">SLARTG</a>,
     $                   <a name="SLASCL.102"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>, <a name="SLASRT.102"></a><a href="slasrt.f.html#SLASRT.1">SLASRT</a>, <a name="XERBLA.102"></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          ABS, MAX, 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><span class="comment">*</span><span class="comment">     Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
<span class="comment">*</span><span class="comment">
</span>      IF( <a name="LSAME.113"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPZ, <span class="string">'N'</span> ) ) THEN
         ICOMPZ = 0
      ELSE IF( <a name="LSAME.115"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPZ, <span class="string">'V'</span> ) ) THEN
         ICOMPZ = 1
      ELSE IF( <a name="LSAME.117"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPZ, <span class="string">'I'</span> ) ) THEN
         ICOMPZ = 2
      ELSE
         ICOMPZ = -1
      END IF
      IF( ICOMPZ.LT.0 ) THEN
         INFO = -1
      ELSE IF( N.LT.0 ) THEN
         INFO = -2
      ELSE IF( ( LDZ.LT.1 ) .OR. ( ICOMPZ.GT.0 .AND. LDZ.LT.MAX( 1,
     $         N ) ) ) THEN
         INFO = -6
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.131"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CSTEQR.131"></a><a href="csteqr.f.html#CSTEQR.1">CSTEQR</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>      IF( N.EQ.1 ) THEN
         IF( ICOMPZ.EQ.2 )
     $      Z( 1, 1 ) = CONE
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Determine the unit roundoff and over/underflow thresholds.
</span><span class="comment">*</span><span class="comment">
</span>      EPS = <a name="SLAMCH.148"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'E'</span> )
      EPS2 = EPS**2
      SAFMIN = <a name="SLAMCH.150"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'S'</span> )
      SAFMAX = ONE / SAFMIN
      SSFMAX = SQRT( SAFMAX ) / THREE
      SSFMIN = SQRT( SAFMIN ) / EPS2
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Compute the eigenvalues and eigenvectors of the tridiagonal
</span><span class="comment">*</span><span class="comment">     matrix.
</span><span class="comment">*</span><span class="comment">

⌨️ 快捷键说明

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