cgesvd.f.html

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

HTML
669
字号
</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.119"></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">  RWORK   (workspace) REAL array, dimension (5*min(M,N))
</span><span class="comment">*</span><span class="comment">          On exit, if INFO &gt; 0, RWORK(1:MIN(M,N)-1) contains the
</span><span class="comment">*</span><span class="comment">          unconverged superdiagonal elements of an upper bidiagonal
</span><span class="comment">*</span><span class="comment">          matrix B whose diagonal is in S (not necessarily sorted).
</span><span class="comment">*</span><span class="comment">          B satisfies A = U * B * VT, so it has the same singular
</span><span class="comment">*</span><span class="comment">          values as A, and singular vectors related by U and VT.
</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 <a name="CBDSQR.131"></a><a href="cbdsqr.f.html#CBDSQR.1">CBDSQR</a> did not converge, INFO specifies how many
</span><span class="comment">*</span><span class="comment">                superdiagonals of an intermediate bidiagonal form B
</span><span class="comment">*</span><span class="comment">                did not converge to zero. See the description of RWORK
</span><span class="comment">*</span><span class="comment">                above for 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">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX            CZERO, CONE
      PARAMETER          ( CZERO = ( 0.0E0, 0.0E0 ),
     $                   CONE = ( 1.0E0, 0.0E0 ) )
      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, WNTUA, WNTUAS, WNTUN, WNTUO, WNTUS,
     $                   WNTVA, WNTVAS, WNTVN, WNTVO, WNTVS
      INTEGER            BLK, CHUNK, I, IE, IERR, IR, IRWORK, ISCL,
     $                   ITAU, ITAUP, ITAUQ, IU, IWORK, LDWRKR, LDWRKU,
     $                   MAXWRK, MINMN, MINWRK, MNTHR, NCU, NCVT, NRU,
     $                   NRVT, WRKBL
      REAL               ANRM, BIGNUM, EPS, SMLNUM
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Arrays ..
</span>      REAL               DUM( 1 )
      COMPLEX            CDUM( 1 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="CBDSQR.159"></a><a href="cbdsqr.f.html#CBDSQR.1">CBDSQR</a>, <a name="CGEBRD.159"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>, <a name="CGELQF.159"></a><a href="cgelqf.f.html#CGELQF.1">CGELQF</a>, CGEMM, <a name="CGEQRF.159"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>, <a name="CLACPY.159"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>,
     $                   <a name="CLASCL.160"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>, <a name="CLASET.160"></a><a href="claset.f.html#CLASET.1">CLASET</a>, <a name="CUNGBR.160"></a><a href="cungbr.f.html#CUNGBR.1">CUNGBR</a>, <a name="CUNGLQ.160"></a><a href="cunglq.f.html#CUNGLQ.1">CUNGLQ</a>, <a name="CUNGQR.160"></a><a href="cungqr.f.html#CUNGQR.1">CUNGQR</a>, <a name="CUNMBR.160"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>,
     $                   <a name="SLASCL.161"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>, <a name="XERBLA.161"></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.164"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      INTEGER            <a name="ILAENV.165"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
      REAL               <a name="CLANGE.166"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="SLAMCH.166"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
      EXTERNAL           <a name="LSAME.167"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="ILAENV.167"></a><a href="hfy-index.html#ILAENV">ILAENV</a>, <a name="CLANGE.167"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="SLAMCH.167"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          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 )
      WNTUA = <a name="LSAME.178"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBU, <span class="string">'A'</span> )
      WNTUS = <a name="LSAME.179"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBU, <span class="string">'S'</span> )
      WNTUAS = WNTUA .OR. WNTUS
      WNTUO = <a name="LSAME.181"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBU, <span class="string">'O'</span> )
      WNTUN = <a name="LSAME.182"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBU, <span class="string">'N'</span> )
      WNTVA = <a name="LSAME.183"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVT, <span class="string">'A'</span> )
      WNTVS = <a name="LSAME.184"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVT, <span class="string">'S'</span> )
      WNTVAS = WNTVA .OR. WNTVS
      WNTVO = <a name="LSAME.186"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVT, <span class="string">'O'</span> )
      WNTVN = <a name="LSAME.187"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBVT, <span class="string">'N'</span> )
      LQUERY = ( LWORK.EQ.-1 )
<span class="comment">*</span><span class="comment">
</span>      IF( .NOT.( WNTUA .OR. WNTUS .OR. WNTUO .OR. WNTUN ) ) THEN
         INFO = -1
      ELSE IF( .NOT.( WNTVA .OR. WNTVS .OR. WNTVO .OR. WNTVN ) .OR.
     $         ( WNTVO .AND. WNTUO ) ) THEN
         INFO = -2
      ELSE IF( M.LT.0 ) THEN
         INFO = -3
      ELSE IF( N.LT.0 ) THEN
         INFO = -4
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
         INFO = -6
      ELSE IF( LDU.LT.1 .OR. ( WNTUAS .AND. LDU.LT.M ) ) THEN
         INFO = -9
      ELSE IF( LDVT.LT.1 .OR. ( WNTVA .AND. LDVT.LT.N ) .OR.
     $         ( WNTVS .AND. LDVT.LT.MINMN ) ) THEN
         INFO = -11
      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.214"></a><a href="hfy-index.html#ILAENV">ILAENV</a>.)
</span><span class="comment">*</span><span class="comment">
</span>      IF( INFO.EQ.0 ) THEN
         MINWRK = 1
         MAXWRK = 1
         IF( M.GE.N .AND. MINMN.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Space needed for <a name="CBDSQR.221"></a><a href="cbdsqr.f.html#CBDSQR.1">CBDSQR</a> is BDSPAC = 5*N
</span><span class="comment">*</span><span class="comment">
</span>            MNTHR = <a name="ILAENV.223"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 6, <span class="string">'<a name="CGESVD.223"></a><a href="cgesvd.f.html#CGESVD.1">CGESVD</a>'</span>, JOBU // JOBVT, M, N, 0, 0 )
            IF( M.GE.MNTHR ) THEN
               IF( WNTUN ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Path 1 (M much larger than N, JOBU='N')
</span><span class="comment">*</span><span class="comment">
</span>                  MAXWRK = N + N*<a name="ILAENV.229"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.229"></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.232"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEBRD.232"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
                  IF( WNTVO .OR. WNTVAS )
     $               MAXWRK = MAX( MAXWRK, 2*N+( N-1 )*
     $                        <a name="ILAENV.235"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNGBR.235"></a><a href="cungbr.f.html#CUNGBR.1">CUNGBR</a>'</span>, <span class="string">'P'</span>, N, N, N, -1 ) )
                  MINWRK = 3*N
               ELSE IF( WNTUO .AND. WNTVN ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Path 2 (M much larger than N, JOBU='O', JOBVT='N')
</span><span class="comment">*</span><span class="comment">
</span>                  WRKBL = N + N*<a name="ILAENV.241"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.241"></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.242"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNGQR.242"></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.245"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEBRD.245"></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.247"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNGBR.247"></a><a href="cungbr.f.html#CUNGBR.1">CUNGBR</a>'</span>, <span class="string">'Q'</span>, N, N, N, -1 ) )
                  MAXWRK = MAX( N*N+WRKBL, N*N+M*N )
                  MINWRK = 2*N + M

⌨️ 快捷键说明

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