slasd1.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 257 行 · 第 1/2 页
HTML
257 行
</span><span class="comment">*</span><span class="comment"> subproblem just solved back into sorted order, i.e.
</span><span class="comment">*</span><span class="comment"> D( IDXQ( I = 1, N ) ) will be in ascending order.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IWORK (workspace) INTEGER array, dimension (4*N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) REAL array, dimension (3*M**2+2*M)
</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: if INFO = 1, an singular value 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><span class="comment">*</span><span class="comment">
</span> REAL ONE, ZERO
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER COLTYP, I, IDX, IDXC, IDXP, IQ, ISIGMA, IU2,
$ IVT2, IZ, K, LDQ, LDU2, LDVT2, M, N, N1, N2
REAL ORGNRM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="SLAMRG.143"></a><a href="slamrg.f.html#SLAMRG.1">SLAMRG</a>, <a name="SLASCL.143"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>, <a name="SLASD2.143"></a><a href="slasd2.f.html#SLASD2.1">SLASD2</a>, <a name="SLASD3.143"></a><a href="slasd3.f.html#SLASD3.1">SLASD3</a>, <a name="XERBLA.143"></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"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, MAX
<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 parameters.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
<span class="comment">*</span><span class="comment">
</span> IF( NL.LT.1 ) THEN
INFO = -1
ELSE IF( NR.LT.1 ) THEN
INFO = -2
ELSE IF( ( SQRE.LT.0 ) .OR. ( SQRE.GT.1 ) ) THEN
INFO = -3
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.162"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SLASD1.162"></a><a href="slasd1.f.html#SLASD1.1">SLASD1</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> N = NL + NR + 1
M = N + SQRE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The following values are for bookkeeping purposes only. They are
</span><span class="comment">*</span><span class="comment"> integer pointers which indicate the portion of the workspace
</span><span class="comment">*</span><span class="comment"> used by a particular array in <a name="SLASD2.171"></a><a href="slasd2.f.html#SLASD2.1">SLASD2</a> and <a name="SLASD3.171"></a><a href="slasd3.f.html#SLASD3.1">SLASD3</a>.
</span><span class="comment">*</span><span class="comment">
</span> LDU2 = N
LDVT2 = M
<span class="comment">*</span><span class="comment">
</span> IZ = 1
ISIGMA = IZ + M
IU2 = ISIGMA + N
IVT2 = IU2 + LDU2*N
IQ = IVT2 + LDVT2*M
<span class="comment">*</span><span class="comment">
</span> IDX = 1
IDXC = IDX + N
COLTYP = IDXC + N
IDXP = COLTYP + N
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale.
</span><span class="comment">*</span><span class="comment">
</span> ORGNRM = MAX( ABS( ALPHA ), ABS( BETA ) )
D( NL+1 ) = ZERO
DO 10 I = 1, N
IF( ABS( D( I ) ).GT.ORGNRM ) THEN
ORGNRM = ABS( D( I ) )
END IF
10 CONTINUE
CALL <a name="SLASCL.196"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>( <span class="string">'G'</span>, 0, 0, ORGNRM, ONE, N, 1, D, N, INFO )
ALPHA = ALPHA / ORGNRM
BETA = BETA / ORGNRM
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Deflate singular values.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SLASD2.202"></a><a href="slasd2.f.html#SLASD2.1">SLASD2</a>( NL, NR, SQRE, K, D, WORK( IZ ), ALPHA, BETA, U, LDU,
$ VT, LDVT, WORK( ISIGMA ), WORK( IU2 ), LDU2,
$ WORK( IVT2 ), LDVT2, IWORK( IDXP ), IWORK( IDX ),
$ IWORK( IDXC ), IDXQ, IWORK( COLTYP ), INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Solve Secular Equation and update singular vectors.
</span><span class="comment">*</span><span class="comment">
</span> LDQ = K
CALL <a name="SLASD3.210"></a><a href="slasd3.f.html#SLASD3.1">SLASD3</a>( NL, NR, SQRE, K, D, WORK( IQ ), LDQ, WORK( ISIGMA ),
$ U, LDU, WORK( IU2 ), LDU2, VT, LDVT, WORK( IVT2 ),
$ LDVT2, IWORK( IDXC ), IWORK( COLTYP ), WORK( IZ ),
$ INFO )
IF( INFO.NE.0 ) THEN
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Unscale.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SLASCL.220"></a><a href="slascl.f.html#SLASCL.1">SLASCL</a>( <span class="string">'G'</span>, 0, 0, ONE, ORGNRM, N, 1, D, N, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Prepare the IDXQ sorting permutation.
</span><span class="comment">*</span><span class="comment">
</span> N1 = K
N2 = N - K
CALL <a name="SLAMRG.226"></a><a href="slamrg.f.html#SLAMRG.1">SLAMRG</a>( N1, N2, D, 1, -1, IDXQ )
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="SLASD1.230"></a><a href="slasd1.f.html#SLASD1.1">SLASD1</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?