sgesdd.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 742 行 · 第 1/5 页
HTML
742 行
</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"> < 0: if INFO = -i, the i-th argument had an illegal value.
</span><span class="comment">*</span><span class="comment"> > 0: <a name="SBDSDC.134"></a><a href="sbdsdc.f.html#SBDSDC.1">SBDSDC</a> did not converge, updating process failed.
</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> 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, WNTQA, WNTQAS, WNTQN, WNTQO, WNTQS
INTEGER BDSPAC, BLK, CHUNK, I, IE, IERR, IL,
$ IR, ISCL, ITAU, ITAUP, ITAUQ, IU, IVT, LDWKVT,
$ LDWRKL, LDWRKR, LDWRKU, MAXWRK, MINMN, MINWRK,
$ MNTHR, 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="SBDSDC.162"></a><a href="sbdsdc.f.html#SBDSDC.1">SBDSDC</a>, <a name="SGEBRD.162"></a><a href="sgebrd.f.html#SGEBRD.1">SGEBRD</a>, <a name="SGELQF.162"></a><a href="sgelqf.f.html#SGELQF.1">SGELQF</a>, SGEMM, <a name="SGEQRF.162"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>, <a name="SLACPY.162"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>,
$ <a name="SLASCL.163"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>, <a name="SLASET.163"></a><a href="slaset.f.html#SLASET.1">SLASET</a>, <a name="SORGBR.163"></a><a href="sorgbr.f.html#SORGBR.1">SORGBR</a>, <a name="SORGLQ.163"></a><a href="sorglq.f.html#SORGLQ.1">SORGLQ</a>, <a name="SORGQR.163"></a><a href="sorgqr.f.html#SORGQR.1">SORGQR</a>, <a name="SORMBR.163"></a><a href="sormbr.f.html#SORMBR.1">SORMBR</a>,
$ <a name="XERBLA.164"></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.167"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
INTEGER <a name="ILAENV.168"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
REAL <a name="SLAMCH.169"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.169"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>
EXTERNAL <a name="ILAENV.170"></a><a href="hfy-index.html#ILAENV">ILAENV</a>, <a name="LSAME.170"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="SLAMCH.170"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.170"></a><a href="slange.f.html#SLANGE.1">SLANGE</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 )
WNTQA = <a name="LSAME.181"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'A'</span> )
WNTQS = <a name="LSAME.182"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'S'</span> )
WNTQAS = WNTQA .OR. WNTQS
WNTQO = <a name="LSAME.184"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'O'</span> )
WNTQN = <a name="LSAME.185"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( JOBZ, <span class="string">'N'</span> )
LQUERY = ( LWORK.EQ.-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 "Workspace:" 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.210"></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"> Compute space needed for <a name="SBDSDC.217"></a><a href="sbdsdc.f.html#SBDSDC.1">SBDSDC</a>
</span><span class="comment">*</span><span class="comment">
</span> MNTHR = INT( MINMN*11.0E0 / 6.0E0 )
IF( WNTQN ) THEN
BDSPAC = 7*N
ELSE
BDSPAC = 3*N*N + 4*N
END IF
IF( M.GE.MNTHR ) 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> WRKBL = N + N*<a name="ILAENV.230"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEQRF.230"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1,
$ -1 )
WRKBL = MAX( WRKBL, 3*N+2*N*
$ <a name="ILAENV.233"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEBRD.233"></a><a href="sgebrd.f.html#SGEBRD.1">SGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
MAXWRK = MAX( WRKBL, BDSPAC+N )
MINWRK = BDSPAC + 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.240"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEQRF.240"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
WRKBL = MAX( WRKBL, N+N*<a name="ILAENV.241"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORGQR.241"></a><a href="sorgqr.f.html#SORGQR.1">SORGQR</a>'</span>, <span class="string">' '</span>, M,
$ N, N, -1 ) )
WRKBL = MAX( WRKBL, 3*N+2*N*
$ <a name="ILAENV.244"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEBRD.244"></a><a href="sgebrd.f.html#SGEBRD.1">SGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
WRKBL = MAX( WRKBL, 3*N+N*
$ <a name="ILAENV.246"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORMBR.246"></a><a href="sormbr.f.html#SORMBR.1">SORMBR</a>'</span>, <span class="string">'QLN'</span>, N, N, N, -1 ) )
WRKBL = MAX( WRKBL, 3*N+N*
$ <a name="ILAENV.248"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORMBR.248"></a><a href="sormbr.f.html#SORMBR.1">SORMBR</a>'</span>, <span class="string">'PRT'</span>, N, N, N, -1 ) )
WRKBL = MAX( WRKBL, BDSPAC+3*N )
MAXWRK = WRKBL + 2*N*N
MINWRK = BDSPAC + 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.256"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEQRF.256"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
WRKBL = MAX( WRKBL, N+N*<a name="ILAENV.257"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORGQR.257"></a><a href="sorgqr.f.html#SORGQR.1">SORGQR</a>'</span>, <span class="string">' '</span>, M,
$ N, N, -1 ) )
WRKBL = MAX( WRKBL, 3*N+2*N*
$ <a name="ILAENV.260"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEBRD.260"></a><a href="sgebrd.f.html#SGEBRD.1">SGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
WRKBL = MAX( WRKBL, 3*N+N*
$ <a name="ILAENV.262"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORMBR.262"></a><a href="sormbr.f.html#SORMBR.1">SORMBR</a>'</span>, <span class="string">'QLN'</span>, N, N, N, -1 ) )
WRKBL = MAX( WRKBL, 3*N+N*
$ <a name="ILAENV.264"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORMBR.264"></a><a href="sormbr.f.html#SORMBR.1">SORMBR</a>'</span>, <span class="string">'PRT'</span>, N, N, N, -1 ) )
WRKBL = MAX( WRKBL, BDSPAC+3*N )
MAXWRK = WRKBL + N*N
MINWRK = BDSPAC + N*N + 3*N
ELSE IF( WNTQA ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Path 4 (M much larger than N, JOBZ='A')
</span><span class="comment">*</span><span class="comment">
</span> WRKBL = N + N*<a name="ILAENV.272"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEQRF.272"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
WRKBL = MAX( WRKBL, N+M*<a name="ILAENV.273"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORGQR.273"></a><a href="sorgqr.f.html#SORGQR.1">SORGQR</a>'</span>, <span class="string">' '</span>, M,
$ M, N, -1 ) )
WRKBL = MAX( WRKBL, 3*N+2*N*
$ <a name="ILAENV.276"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SGEBRD.276"></a><a href="sgebrd.f.html#SGEBRD.1">SGEBRD</a>'</span>, <span class="string">' '</span>, N, N, -1, -1 ) )
WRKBL = MAX( WRKBL, 3*N+N*
$ <a name="ILAENV.278"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="SORMBR.278"></a><a href="sormbr.f.html#SORMBR.1">SORMBR</a>'</span>, <span class="string">'QLN'</span>, N, N, N, -1 ) )
WRKBL = MAX( WRKBL, 3*N+N*
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?