cgesdd.f.html

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

HTML
713
字号
</span><span class="comment">*</span><span class="comment">          and no other work except argument checking is performed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  RWORK   (workspace) REAL array, dimension (MAX(1,LRWORK))
</span><span class="comment">*</span><span class="comment">          If JOBZ = 'N', LRWORK &gt;= 5*min(M,N).
</span><span class="comment">*</span><span class="comment">          Otherwise, LRWORK &gt;= 5*min(M,N)*min(M,N) + 7*min(M,N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  IWORK   (workspace) INTEGER array, dimension (8*min(M,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 updating process of <a name="SBDSDC.136"></a><a href="sbdsdc.f.html#SBDSDC.1">SBDSDC</a> did not converge.
</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">     Ming Gu and Huan Ren, Computer Science Division, University of
</span><span class="comment">*</span><span class="comment">     California 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>      INTEGER            LQUERV
      PARAMETER          ( LQUERV = -1 )
      COMPLEX            CZERO, CONE
      PARAMETER          ( CZERO = ( 0.0E+0, 0.0E+0 ),
     $                   CONE = ( 1.0E+0, 0.0E+0 ) )
      REAL               ZERO, ONE
      PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      LOGICAL            WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
      INTEGER            BLK, CHUNK, I, IE, IERR, IL, IR, IRU, IRVT,
     $                   ISCL, ITAU, ITAUP, ITAUQ, IU, IVT, LDWKVT,
     $                   LDWRKL, LDWRKR, LDWRKU, MAXWRK, MINMN, MINWRK,
     $                   MNTHR1, MNTHR2, NRWORK, NWORK, WRKBL
      REAL               ANRM, BIGNUM, EPS, SMLNUM
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Arrays ..
</span>      INTEGER            IDUM( 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="CGEBRD.169"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>, <a name="CGELQF.169"></a><a href="cgelqf.f.html#CGELQF.1">CGELQF</a>, CGEMM, <a name="CGEQRF.169"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>, <a name="CLACP2.169"></a><a href="clacp2.f.html#CLACP2.1">CLACP2</a>, <a name="CLACPY.169"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>,
     $                   <a name="CLACRM.170"></a><a href="clacrm.f.html#CLACRM.1">CLACRM</a>, <a name="CLARCM.170"></a><a href="clarcm.f.html#CLARCM.1">CLARCM</a>, <a name="CLASCL.170"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>, <a name="CLASET.170"></a><a href="claset.f.html#CLASET.1">CLASET</a>, <a name="CUNGBR.170"></a><a href="cungbr.f.html#CUNGBR.1">CUNGBR</a>, <a name="CUNGLQ.170"></a><a href="cunglq.f.html#CUNGLQ.1">CUNGLQ</a>,
     $                   <a name="CUNGQR.171"></a><a href="cungqr.f.html#CUNGQR.1">CUNGQR</a>, <a name="CUNMBR.171"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>, <a name="SBDSDC.171"></a><a href="sbdsdc.f.html#SBDSDC.1">SBDSDC</a>, <a name="SLASCL.171"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>, <a name="XERBLA.171"></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.174"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      INTEGER            <a name="ILAENV.175"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
      REAL               <a name="CLANGE.176"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="SLAMCH.176"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
      EXTERNAL           <a name="CLANGE.177"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="SLAMCH.177"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="ILAENV.177"></a><a href="hfy-index.html#ILAENV">ILAENV</a>, <a name="LSAME.177"></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">     .. Intrinsic Functions ..
</span>      INTRINSIC          INT, MAX, MIN, 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
      MINMN = MIN( M, N )
      MNTHR1 = INT( MINMN*17.0 / 9.0 )
      MNTHR2 = INT( MINMN*5.0 / 3.0 )
      WNTQA = <a name="LSAME.190"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'A'</span> )
      WNTQS = <a name="LSAME.191"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'S'</span> )
      WNTQAS = WNTQA .OR. WNTQS
      WNTQO = <a name="LSAME.193"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'O'</span> )
      WNTQN = <a name="LSAME.194"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'N'</span> )
      MINWRK = 1
      MAXWRK = 1
<span class="comment">*</span><span class="comment">
</span>      IF( .NOT.( WNTQA .OR. WNTQS .OR. WNTQO .OR. WNTQN ) ) THEN
         INFO = -1
      ELSE IF( M.LT.0 ) THEN
         INFO = -2
      ELSE IF( N.LT.0 ) THEN
         INFO = -3
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
         INFO = -5
      ELSE IF( LDU.LT.1 .OR. ( WNTQAS .AND. LDU.LT.M ) .OR.
     $         ( WNTQO .AND. M.LT.N .AND. LDU.LT.M ) ) THEN
         INFO = -8
      ELSE IF( LDVT.LT.1 .OR. ( WNTQA .AND. LDVT.LT.N ) .OR.
     $         ( WNTQS .AND. LDVT.LT.MINMN ) .OR.
     $         ( WNTQO .AND. M.GE.N .AND. LDVT.LT.N ) ) THEN
         INFO = -10
      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">       CWorkspace refers to complex workspace, and RWorkspace to
</span><span class="comment">*</span><span class="comment">       real workspace. NB refers to the optimal block size for the
</span><span class="comment">*</span><span class="comment">       immediately following subroutine, as returned by <a name="ILAENV.221"></a><a href="hfy-index.html#ILAENV">ILAENV</a>.)
</span><span class="comment">*</span><span class="comment">
</span>      IF( INFO.EQ.0 .AND. M.GT.0 .AND. N.GT.0 ) THEN
         IF( M.GE.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           There is no complex work space needed for bidiagonal SVD
</span><span class="comment">*</span><span class="comment">           The real work space needed for bidiagonal SVD is BDSPAC
</span><span class="comment">*</span><span class="comment">           for computing singular values and singular vectors; BDSPAN
</span><span class="comment">*</span><span class="comment">           for computing singular values only.
</span><span class="comment">*</span><span class="comment">           BDSPAC = 5*N*N + 7*N
</span><span class="comment">*</span><span class="comment">           BDSPAN = MAX(7*N+4, 3*N+2+SMLSIZ*(SMLSIZ+8))
</span><span class="comment">*</span><span class="comment">
</span>            IF( M.GE.MNTHR1 ) THEN
               IF( WNTQN ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Path 1 (M much larger than N, JOBZ='N')
</span><span class="comment">*</span><span class="comment">
</span>                  MAXWRK = N + N*<a name="ILAENV.238"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.238"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1,
     $                     -1 )
                  MAXWRK = MAX( MAXWRK, 2*N+2*N*
     $                     <a name="ILAENV.241"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEBRD.241"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
                  MINWRK = 3*N
               ELSE IF( WNTQO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Path 2 (M much larger than N, JOBZ='O')
</span><span class="comment">*</span><span class="comment">
</span>                  WRKBL = N + N*<a name="ILAENV.247"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.247"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
                  WRKBL = MAX( WRKBL, N+N*<a name="ILAENV.248"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNGQR.248"></a><a href="cungqr.f.html#CUNGQR.1">CUNGQR</a>'</span>, <span class="string">' '</span>, M,
     $                    N, N, -1 ) )
                  WRKBL = MAX( WRKBL, 2*N+2*N*
     $                    <a name="ILAENV.251"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEBRD.251"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
                  WRKBL = MAX( WRKBL, 2*N+N*
     $                    <a name="ILAENV.253"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMBR.253"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>'</span>, <span class="string">'QLN'</span>, N, N, N, -1 ) )
                  WRKBL = MAX( WRKBL, 2*N+N*
     $                    <a name="ILAENV.255"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMBR.255"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>'</span>, <span class="string">'PRC'</span>, N, N, N, -1 ) )
                  MAXWRK = M*N + N*N + WRKBL
                  MINWRK = 2*N*N + 3*N
               ELSE IF( WNTQS ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Path 3 (M much larger than N, JOBZ='S')
</span><span class="comment">*</span><span class="comment">
</span>                  WRKBL = N + N*<a name="ILAENV.262"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.262"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
                  WRKBL = MAX( WRKBL, N+N*<a name="ILAENV.263"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNGQR.263"></a><a href="cungqr.f.html#CUNGQR.1">CUNGQR</a>'</span>, <span class="string">' '</span>, M,
     $                    N, N, -1 ) )
                  WRKBL = MAX( WRKBL, 2*N+2*N*
     $                    <a name="ILAENV.266"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEBRD.266"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
                  WRKBL = MAX( WRKBL, 2*N+N*

⌨️ 快捷键说明

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