slaed0.f.html

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

HTML
374
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>slaed0.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="SLAED0.1"></a><a href="slaed0.f.html#SLAED0.1">SLAED0</a>( ICOMPQ, QSIZ, N, D, E, Q, LDQ, QSTORE, LDQS,
     $                   WORK, IWORK, 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>      INTEGER            ICOMPQ, INFO, LDQ, LDQS, N, QSIZ
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      INTEGER            IWORK( * )
      REAL               D( * ), E( * ), Q( LDQ, * ), QSTORE( LDQS, * ),
     $                   WORK( * )
<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="SLAED0.20"></a><a href="slaed0.f.html#SLAED0.1">SLAED0</a> computes all eigenvalues and corresponding eigenvectors of a
</span><span class="comment">*</span><span class="comment">  symmetric tridiagonal matrix using the divide and conquer method.
</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">  ICOMPQ  (input) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0:  Compute eigenvalues only.
</span><span class="comment">*</span><span class="comment">          = 1:  Compute eigenvectors of original dense symmetric matrix
</span><span class="comment">*</span><span class="comment">                also.  On entry, Q contains the orthogonal matrix used
</span><span class="comment">*</span><span class="comment">                to reduce the original matrix to tridiagonal form.
</span><span class="comment">*</span><span class="comment">          = 2:  Compute eigenvalues and eigenvectors of tridiagonal
</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">  QSIZ   (input) INTEGER
</span><span class="comment">*</span><span class="comment">         The dimension of the orthogonal matrix used to reduce
</span><span class="comment">*</span><span class="comment">         the full matrix to tridiagonal form.  QSIZ &gt;= N if ICOMPQ = 1.
</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 dimension of the symmetric tridiagonal 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 main diagonal of the tridiagonal matrix.
</span><span class="comment">*</span><span class="comment">         On exit, its eigenvalues.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  E      (input) REAL array, dimension (N-1)
</span><span class="comment">*</span><span class="comment">         The off-diagonal elements of the tridiagonal 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">  Q      (input/output) REAL array, dimension (LDQ, N)
</span><span class="comment">*</span><span class="comment">         On entry, Q must contain an N-by-N orthogonal matrix.
</span><span class="comment">*</span><span class="comment">         If ICOMPQ = 0    Q is not referenced.
</span><span class="comment">*</span><span class="comment">         If ICOMPQ = 1    On entry, Q is a subset of the columns of the
</span><span class="comment">*</span><span class="comment">                          orthogonal matrix used to reduce the full
</span><span class="comment">*</span><span class="comment">                          matrix to tridiagonal form corresponding to
</span><span class="comment">*</span><span class="comment">                          the subset of the full matrix which is being
</span><span class="comment">*</span><span class="comment">                          decomposed at this time.
</span><span class="comment">*</span><span class="comment">         If ICOMPQ = 2    On entry, Q will be the identity matrix.
</span><span class="comment">*</span><span class="comment">                          On exit, Q contains the eigenvectors of the
</span><span class="comment">*</span><span class="comment">                          tridiagonal matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDQ    (input) INTEGER
</span><span class="comment">*</span><span class="comment">         The leading dimension of the array Q.  If eigenvectors are
</span><span class="comment">*</span><span class="comment">         desired, then  LDQ &gt;= max(1,N).  In any case,  LDQ &gt;= 1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  QSTORE (workspace) REAL array, dimension (LDQS, N)
</span><span class="comment">*</span><span class="comment">         Referenced only when ICOMPQ = 1.  Used to store parts of
</span><span class="comment">*</span><span class="comment">         the eigenvector matrix when the updating matrix multiplies
</span><span class="comment">*</span><span class="comment">         take place.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDQS   (input) INTEGER
</span><span class="comment">*</span><span class="comment">         The leading dimension of the array QSTORE.  If ICOMPQ = 1,
</span><span class="comment">*</span><span class="comment">         then  LDQS &gt;= max(1,N).  In any case,  LDQS &gt;= 1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK   (workspace) REAL array,
</span><span class="comment">*</span><span class="comment">         If ICOMPQ = 0 or 1, the dimension of WORK must be at least
</span><span class="comment">*</span><span class="comment">                     1 + 3*N + 2*N*lg N + 2*N**2
</span><span class="comment">*</span><span class="comment">                     ( lg( N ) = smallest integer k
</span><span class="comment">*</span><span class="comment">                                 such that 2^k &gt;= N )
</span><span class="comment">*</span><span class="comment">         If ICOMPQ = 2, the dimension of WORK must be at least
</span><span class="comment">*</span><span class="comment">                     4*N + N**2.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  IWORK  (workspace) INTEGER array,
</span><span class="comment">*</span><span class="comment">         If ICOMPQ = 0 or 1, the dimension of IWORK must be at least
</span><span class="comment">*</span><span class="comment">                        6 + 6*N + 5*N*lg N.
</span><span class="comment">*</span><span class="comment">                        ( lg( N ) = smallest integer k
</span><span class="comment">*</span><span class="comment">                                    such that 2^k &gt;= N )
</span><span class="comment">*</span><span class="comment">         If ICOMPQ = 2, the dimension of IWORK must be at least
</span><span class="comment">*</span><span class="comment">                        3 + 5*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">          &gt; 0:  The algorithm failed to compute an eigenvalue while
</span><span class="comment">*</span><span class="comment">                working on the submatrix lying in rows and columns
</span><span class="comment">*</span><span class="comment">                INFO/(N+1) through mod(INFO,N+1).
</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">     Jeff Rutter, Computer Science Division, University of California
</span><span class="comment">*</span><span class="comment">     at 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>      REAL               ZERO, ONE, TWO
      PARAMETER          ( ZERO = 0.E0, ONE = 1.E0, TWO = 2.E0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            CURLVL, CURPRB, CURR, I, IGIVCL, IGIVNM,
     $                   IGIVPT, INDXQ, IPERM, IPRMPT, IQ, IQPTR, IWREM,
     $                   J, K, LGN, MATSIZ, MSD2, SMLSIZ, SMM1, SPM1,
     $                   SPM2, SUBMAT, SUBPBS, TLVLS
      REAL               TEMP
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           SCOPY, SGEMM, <a name="SLACPY.118"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>, <a name="SLAED1.118"></a><a href="slaed1.f.html#SLAED1.1">SLAED1</a>, <a name="SLAED7.118"></a><a href="slaed7.f.html#SLAED7.1">SLAED7</a>, <a name="SSTEQR.118"></a><a href="ssteqr.f.html#SSTEQR.1">SSTEQR</a>,
     $                   <a name="XERBLA.119"></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">     .. External Functions ..
</span>      INTEGER            <a name="ILAENV.122"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
      EXTERNAL           <a name="ILAENV.123"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          ABS, INT, LOG, MAX, REAL
<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( ICOMPQ.LT.0 .OR. ICOMPQ.GT.2 ) THEN
         INFO = -1
      ELSE IF( ( ICOMPQ.EQ.1 ) .AND. ( QSIZ.LT.MAX( 0, N ) ) ) THEN
         INFO = -2
      ELSE IF( N.LT.0 ) THEN
         INFO = -3
      ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN
         INFO = -7
      ELSE IF( LDQS.LT.MAX( 1, N ) ) THEN
         INFO = -9
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.146"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SLAED0.146"></a><a href="slaed0.f.html#SLAED0.1">SLAED0</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>      SMLSIZ = <a name="ILAENV.155"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 9, <span class="string">'<a name="SLAED0.155"></a><a href="slaed0.f.html#SLAED0.1">SLAED0</a>'</span>, <span class="string">' '</span>, 0, 0, 0, 0 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Determine the size and placement of the submatrices, and save in
</span><span class="comment">*</span><span class="comment">     the leading elements of IWORK.
</span><span class="comment">*</span><span class="comment">
</span>      IWORK( 1 ) = N
      SUBPBS = 1
      TLVLS = 0
   10 CONTINUE
      IF( IWORK( SUBPBS ).GT.SMLSIZ ) THEN
         DO 20 J = SUBPBS, 1, -1
            IWORK( 2*J ) = ( IWORK( J )+1 ) / 2
            IWORK( 2*J-1 ) = IWORK( J ) / 2
   20    CONTINUE

⌨️ 快捷键说明

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