sgeevx.f.html

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

HTML
580
字号
</span><span class="comment">*</span><span class="comment">          JOBVL = 'V', LDVL &gt;= N.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  VR      (output) REAL array, dimension (LDVR,N)
</span><span class="comment">*</span><span class="comment">          If JOBVR = 'V', the right eigenvectors v(j) are stored one
</span><span class="comment">*</span><span class="comment">          after another in the columns of VR, in the same order
</span><span class="comment">*</span><span class="comment">          as their eigenvalues.
</span><span class="comment">*</span><span class="comment">          If JOBVR = 'N', VR is not referenced.
</span><span class="comment">*</span><span class="comment">          If the j-th eigenvalue is real, then v(j) = VR(:,j),
</span><span class="comment">*</span><span class="comment">          the j-th column of VR.
</span><span class="comment">*</span><span class="comment">          If the j-th and (j+1)-st eigenvalues form a complex
</span><span class="comment">*</span><span class="comment">          conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and
</span><span class="comment">*</span><span class="comment">          v(j+1) = VR(:,j) - i*VR(:,j+1).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDVR    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array VR.  LDVR &gt;= 1, and if
</span><span class="comment">*</span><span class="comment">          JOBVR = 'V', LDVR &gt;= N.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ILO     (output) INTEGER
</span><span class="comment">*</span><span class="comment">  IHI     (output) INTEGER
</span><span class="comment">*</span><span class="comment">          ILO and IHI are integer values determined when A was
</span><span class="comment">*</span><span class="comment">          balanced.  The balanced A(i,j) = 0 if I &gt; J and 
</span><span class="comment">*</span><span class="comment">          J = 1,...,ILO-1 or I = IHI+1,...,N.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  SCALE   (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment">          Details of the permutations and scaling factors applied
</span><span class="comment">*</span><span class="comment">          when balancing A.  If P(j) is the index of the row and column
</span><span class="comment">*</span><span class="comment">          interchanged with row and column j, and D(j) is the scaling
</span><span class="comment">*</span><span class="comment">          factor applied to row and column j, then
</span><span class="comment">*</span><span class="comment">          SCALE(J) = P(J),    for J = 1,...,ILO-1
</span><span class="comment">*</span><span class="comment">                   = D(J),    for J = ILO,...,IHI
</span><span class="comment">*</span><span class="comment">                   = P(J)     for J = IHI+1,...,N.
</span><span class="comment">*</span><span class="comment">          The order in which the interchanges are made is N to IHI+1,
</span><span class="comment">*</span><span class="comment">          then 1 to ILO-1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ABNRM   (output) REAL
</span><span class="comment">*</span><span class="comment">          The one-norm of the balanced matrix (the maximum
</span><span class="comment">*</span><span class="comment">          of the sum of absolute values of elements of any column).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  RCONDE  (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment">          RCONDE(j) is the reciprocal condition number of the j-th
</span><span class="comment">*</span><span class="comment">          eigenvalue.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  RCONDV  (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment">          RCONDV(j) is the reciprocal condition number of the j-th
</span><span class="comment">*</span><span class="comment">          right eigenvector.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace/output) REAL array, dimension (MAX(1,LWORK))
</span><span class="comment">*</span><span class="comment">          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LWORK   (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The dimension of the array WORK.   If SENSE = 'N' or 'E',
</span><span class="comment">*</span><span class="comment">          LWORK &gt;= max(1,2*N), and if JOBVL = 'V' or JOBVR = 'V',
</span><span class="comment">*</span><span class="comment">          LWORK &gt;= 3*N.  If SENSE = 'V' or 'B', LWORK &gt;= N*(N+6).
</span><span class="comment">*</span><span class="comment">          For good performance, LWORK must generally be larger.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">          If LWORK = -1, then a workspace query is assumed; the routine
</span><span class="comment">*</span><span class="comment">          only calculates the optimal size of the WORK array, returns
</span><span class="comment">*</span><span class="comment">          this value as the first entry of the WORK array, and no error
</span><span class="comment">*</span><span class="comment">          message related to LWORK is issued by <a name="XERBLA.185"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  IWORK   (workspace) INTEGER array, dimension (2*N-2)
</span><span class="comment">*</span><span class="comment">          If SENSE = 'N' or 'E', 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:  if INFO = i, the QR algorithm failed to compute all the
</span><span class="comment">*</span><span class="comment">                eigenvalues, and no eigenvectors or condition numbers
</span><span class="comment">*</span><span class="comment">                have been computed; elements 1:ILO-1 and i+1:N of WR
</span><span class="comment">*</span><span class="comment">                and WI contain eigenvalues which have converged.
</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.0E0, ONE = 1.0E0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      LOGICAL            LQUERY, SCALEA, WANTVL, WANTVR, WNTSNB, WNTSNE,
     $                   WNTSNN, WNTSNV
      CHARACTER          JOB, SIDE
      INTEGER            HSWORK, I, ICOND, IERR, ITAU, IWRK, K, MAXWRK,
     $                   MINWRK, NOUT
      REAL               ANRM, BIGNUM, CS, CSCALE, EPS, R, SCL, SMLNUM,
     $                   SN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Arrays ..
</span>      LOGICAL            SELECT( 1 )
      REAL               DUM( 1 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="SGEBAK.218"></a><a href="sgebak.f.html#SGEBAK.1">SGEBAK</a>, <a name="SGEBAL.218"></a><a href="sgebal.f.html#SGEBAL.1">SGEBAL</a>, <a name="SGEHRD.218"></a><a href="sgehrd.f.html#SGEHRD.1">SGEHRD</a>, <a name="SHSEQR.218"></a><a href="shseqr.f.html#SHSEQR.1">SHSEQR</a>, <a name="SLABAD.218"></a><a href="slabad.f.html#SLABAD.1">SLABAD</a>, <a name="SLACPY.218"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>,
     $                   <a name="SLARTG.219"></a><a href="slartg.f.html#SLARTG.1">SLARTG</a>, <a name="SLASCL.219"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>, <a name="SORGHR.219"></a><a href="sorghr.f.html#SORGHR.1">SORGHR</a>, SROT, SSCAL, <a name="STREVC.219"></a><a href="strevc.f.html#STREVC.1">STREVC</a>,
     $                   <a name="STRSNA.220"></a><a href="strsna.f.html#STRSNA.1">STRSNA</a>, <a name="XERBLA.220"></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>      LOGICAL            <a name="LSAME.223"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      INTEGER            <a name="ILAENV.224"></a><a href="hfy-index.html#ILAENV">ILAENV</a>, ISAMAX
      REAL               <a name="SLAMCH.225"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.225"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>, <a name="SLAPY2.225"></a><a href="slapy2.f.html#SLAPY2.1">SLAPY2</a>, SNRM2
      EXTERNAL           <a name="LSAME.226"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="ILAENV.226"></a><a href="hfy-index.html#ILAENV">ILAENV</a>, ISAMAX, <a name="SLAMCH.226"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.226"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>, <a name="SLAPY2.226"></a><a href="slapy2.f.html#SLAPY2.1">SLAPY2</a>,
     $                   SNRM2
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          MAX, 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 arguments
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      LQUERY = ( LWORK.EQ.-1 )
      WANTVL = <a name="LSAME.238"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVL, <span class="string">'V'</span> )
      WANTVR = <a name="LSAME.239"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVR, <span class="string">'V'</span> )
      WNTSNN = <a name="LSAME.240"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SENSE, <span class="string">'N'</span> )
      WNTSNE = <a name="LSAME.241"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SENSE, <span class="string">'E'</span> )
      WNTSNV = <a name="LSAME.242"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SENSE, <span class="string">'V'</span> )
      WNTSNB = <a name="LSAME.243"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SENSE, <span class="string">'B'</span> )
      IF( .NOT.( <a name="LSAME.244"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( BALANC, <span class="string">'N'</span> ) .OR. <a name="LSAME.244"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( BALANC, <span class="string">'S'</span> ) .OR.
     $    <a name="LSAME.245"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( BALANC, <span class="string">'P'</span> ) .OR. <a name="LSAME.245"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( BALANC, <span class="string">'B'</span> ) ) ) THEN
         INFO = -1
      ELSE IF( ( .NOT.WANTVL ) .AND. ( .NOT.<a name="LSAME.247"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVL, <span class="string">'N'</span> ) ) ) THEN
         INFO = -2
      ELSE IF( ( .NOT.WANTVR ) .AND. ( .NOT.<a name="LSAME.249"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVR, <span class="string">'N'</span> ) ) ) THEN
         INFO = -3
      ELSE IF( .NOT.( WNTSNN .OR. WNTSNE .OR. WNTSNB .OR. WNTSNV ) .OR.
     $         ( ( WNTSNE .OR. WNTSNB ) .AND. .NOT.( WANTVL .AND.
     $         WANTVR ) ) ) THEN
         INFO = -4
      ELSE IF( N.LT.0 ) THEN
         INFO = -5
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
         INFO = -7
      ELSE IF( LDVL.LT.1 .OR. ( WANTVL .AND. LDVL.LT.N ) ) THEN
         INFO = -11
      ELSE IF( LDVR.LT.1 .OR. ( WANTVR .AND. LDVR.LT.N ) ) THEN
         INFO = -13
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Compute workspace
</span><span class="comment">*</span><span class="comment">      (Note: Comments in the code beginning &quot;Workspace:&quot; describe the
</span><span class="comment">*</span><span class="comment">       minimal amount of workspace needed at that point in the code,
</span><span class="comment">*</span><span class="comment">       as well as the preferred amount for good performance.
</span><span class="comment">*</span><span class="comment">       NB refers to the optimal block size for the immediately
</span><span class="comment">*</span><span class="comment">       following subroutine, as returned by <a name="ILAENV.270"></a><a href="hfy-index.html#ILAENV">ILAENV</a>.
</span><span class="comment">*</span><span class="comment">       HSWORK refers to the workspace preferred by <a name="SHSEQR.271"></a><a href="shseqr.f.html#SHSEQR.1">SHSEQR</a>, as

⌨️ 快捷键说明

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