cgelsd.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 592 行 · 第 1/4 页
HTML
592 行
</span><span class="comment">*</span><span class="comment"> where MINMN = MIN( M,N ).
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, IWORK(1) returns the minimum LIWORK.
</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"> < 0: if INFO = -i, the i-th argument had an illegal value.
</span><span class="comment">*</span><span class="comment"> > 0: the algorithm for computing the SVD failed to converge;
</span><span class="comment">*</span><span class="comment"> if INFO = i, i off-diagonal elements of an intermediate
</span><span class="comment">*</span><span class="comment"> bidiagonal form did not converge to zero.
</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 Ren-Cang Li, 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"> Osni Marques, LBNL/NERSC, 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.0E+0, ONE = 1.0E+0, TWO = 2.0E+0 )
COMPLEX CZERO
PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL LQUERY
INTEGER IASCL, IBSCL, IE, IL, ITAU, ITAUP, ITAUQ,
$ LDWORK, LIWORK, LRWORK, MAXMN, MAXWRK, MINMN,
$ MINWRK, MM, MNTHR, NLVL, NRWORK, NWORK, SMLSIZ
REAL ANRM, BIGNUM, BNRM, EPS, SFMIN, SMLNUM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="CGEBRD.164"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>, <a name="CGELQF.164"></a><a href="cgelqf.f.html#CGELQF.1">CGELQF</a>, <a name="CGEQRF.164"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>, <a name="CLACPY.164"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>,
$ <a name="CLALSD.165"></a><a href="clalsd.f.html#CLALSD.1">CLALSD</a>, <a name="CLASCL.165"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>, <a name="CLASET.165"></a><a href="claset.f.html#CLASET.1">CLASET</a>, <a name="CUNMBR.165"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>,
$ <a name="CUNMLQ.166"></a><a href="cunmlq.f.html#CUNMLQ.1">CUNMLQ</a>, <a name="CUNMQR.166"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>, <a name="SLABAD.166"></a><a href="slabad.f.html#SLABAD.1">SLABAD</a>, <a name="SLASCL.166"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>,
$ <a name="SLASET.167"></a><a href="slaset.f.html#SLASET.1">SLASET</a>, <a name="XERBLA.167"></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.170"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
REAL <a name="CLANGE.171"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="SLAMCH.171"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
EXTERNAL <a name="CLANGE.172"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="SLAMCH.172"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="ILAENV.172"></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 INT, LOG, MAX, MIN, 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 arguments.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
MINMN = MIN( M, N )
MAXMN = MAX( M, N )
LQUERY = ( LWORK.EQ.-1 )
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( NRHS.LT.0 ) THEN
INFO = -3
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -5
ELSE IF( LDB.LT.MAX( 1, MAXMN ) ) THEN
INFO = -7
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.202"></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
LIWORK = 1
LRWORK = 1
IF( MINMN.GT.0 ) THEN
SMLSIZ = <a name="ILAENV.210"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 9, <span class="string">'<a name="CGELSD.210"></a><a href="cgelsd.f.html#CGELSD.1">CGELSD</a>'</span>, <span class="string">' '</span>, 0, 0, 0, 0 )
MNTHR = <a name="ILAENV.211"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 6, <span class="string">'<a name="CGELSD.211"></a><a href="cgelsd.f.html#CGELSD.1">CGELSD</a>'</span>, <span class="string">' '</span>, M, N, NRHS, -1 )
NLVL = MAX( INT( LOG( REAL( MINMN ) / REAL( SMLSIZ + 1 ) ) /
$ LOG( TWO ) ) + 1, 0 )
LIWORK = 3*MINMN*NLVL + 11*MINMN
MM = M
IF( M.GE.N .AND. M.GE.MNTHR ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Path 1a - overdetermined, with many more rows than
</span><span class="comment">*</span><span class="comment"> columns.
</span><span class="comment">*</span><span class="comment">
</span> MM = N
MAXWRK = MAX( MAXWRK, N*<a name="ILAENV.222"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.222"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>'</span>, <span class="string">' '</span>, M, N,
$ -1, -1 ) )
MAXWRK = MAX( MAXWRK, NRHS*<a name="ILAENV.224"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMQR.224"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>'</span>, <span class="string">'LC'</span>, M,
$ NRHS, N, -1 ) )
END IF
IF( M.GE.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Path 1 - overdetermined or exactly determined.
</span><span class="comment">*</span><span class="comment">
</span> LRWORK = 10*N + 2*N*SMLSIZ + 8*N*NLVL + 3*SMLSIZ*NRHS +
$ ( SMLSIZ + 1 )**2
MAXWRK = MAX( MAXWRK, 2*N + ( MM + N )*<a name="ILAENV.233"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1,
$ <span class="string">'<a name="CGEBRD.234"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>'</span>, <span class="string">' '</span>, MM, N, -1, -1 ) )
MAXWRK = MAX( MAXWRK, 2*N + NRHS*<a name="ILAENV.235"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMBR.235"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>'</span>,
$ <span class="string">'QLC'</span>, MM, NRHS, N, -1 ) )
MAXWRK = MAX( MAXWRK, 2*N + ( N - 1 )*<a name="ILAENV.237"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1,
$ <span class="string">'<a name="CUNMBR.238"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>'</span>, <span class="string">'PLN'</span>, N, NRHS, N, -1 ) )
MAXWRK = MAX( MAXWRK, 2*N + N*NRHS )
MINWRK = MAX( 2*N + MM, 2*N + N*NRHS )
END IF
IF( N.GT.M ) THEN
LRWORK = 10*M + 2*M*SMLSIZ + 8*M*NLVL + 3*SMLSIZ*NRHS +
$ ( SMLSIZ + 1 )**2
IF( N.GE.MNTHR ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Path 2a - underdetermined, with many more columns
</span><span class="comment">*</span><span class="comment"> than rows.
</span><span class="comment">*</span><span class="comment">
</span> MAXWRK = M + M*<a name="ILAENV.250"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGELQF.250"></a><a href="cgelqf.f.html#CGELQF.1">CGELQF</a>'</span>, <span class="string">' '</span>, M, N, -1,
$ -1 )
MAXWRK = MAX( MAXWRK, M*M + 4*M + 2*M*<a name="ILAENV.252"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1,
$ <span class="string">'<a name="CGEBRD.253"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>'</span>, <span class="string">' '</span>, M, M, -1, -1 ) )
MAXWRK = MAX( MAXWRK, M*M + 4*M + NRHS*<a name="ILAENV.254"></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">'QLC'</span>, M, NRHS, M, -1 ) )
MAXWRK = MAX( MAXWRK, M*M + 4*M + ( M - 1 )*<a name="ILAENV.256"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1,
$ <span class="string">'<a name="CUNMLQ.257"></a><a href="cunmlq.f.html#CUNMLQ.1">CUNMLQ</a>'</span>, <span class="string">'LC'</span>, N, NRHS, M, -1 ) )
IF( NRHS.GT.1 ) THEN
MAXWRK = MAX( MAXWRK, M*M + M + M*NRHS )
ELSE
MAXWRK = MAX( MAXWRK, M*M + 2*M )
END IF
MAXWRK = MAX( MAXWRK, M*M + 4*M + M*NRHS )
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Path 2 - underdetermined.
</span><span class="comment">*</span><span class="comment">
</span> MAXWRK = 2*M + ( N + M )*<a name="ILAENV.268"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEBRD.268"></a><a href="cgebrd.f.html#CGEBRD.1">CGEBRD</a>'</span>, <span class="string">' '</span>, M,
$ N, -1, -1 )
MAXWRK = MAX( MAXWRK, 2*M + NRHS*<a name="ILAENV.270"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMBR.270"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>'</span>,
$ <span class="string">'QLC'</span>, M, NRHS, M, -1 ) )
MAXWRK = MAX( MAXWRK, 2*M + M*<a name="ILAENV.272"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMBR.272"></a><a href="cunmbr.f.html#CUNMBR.1">CUNMBR</a>'</span>,
$ <span class="string">'PLN'</span>, N, NRHS, M, -1 ) )
MAXWRK = MAX( MAXWRK, 2*M + M*NRHS )
END IF
MINWRK = MAX( 2*M + N, 2*M + M*NRHS )
END IF
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?