dlasd0.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 255 行 · 第 1/2 页
HTML
255 行
INFO = -6
ELSE IF( LDVT.LT.M ) THEN
INFO = -8
ELSE IF( SMLSIZ.LT.3 ) THEN
INFO = -9
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.117"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DLASD0.117"></a><a href="dlasd0.f.html#DLASD0.1">DLASD0</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If the input matrix is too small, call <a name="DLASDQ.121"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a> to find the SVD.
</span><span class="comment">*</span><span class="comment">
</span> IF( N.LE.SMLSIZ ) THEN
CALL <a name="DLASDQ.124"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>( <span class="string">'U'</span>, SQRE, N, M, N, 0, D, E, VT, LDVT, U, LDU, U,
$ LDU, WORK, INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Set up the computation tree.
</span><span class="comment">*</span><span class="comment">
</span> INODE = 1
NDIML = INODE + N
NDIMR = NDIML + N
IDXQ = NDIMR + N
IWK = IDXQ + N
CALL <a name="DLASDT.136"></a><a href="dlasdt.f.html#DLASDT.1">DLASDT</a>( N, NLVL, ND, IWORK( INODE ), IWORK( NDIML ),
$ IWORK( NDIMR ), SMLSIZ )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> For the nodes on bottom level of the tree, solve
</span><span class="comment">*</span><span class="comment"> their subproblems by <a name="DLASDQ.140"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>.
</span><span class="comment">*</span><span class="comment">
</span> NDB1 = ( ND+1 ) / 2
NCC = 0
DO 30 I = NDB1, ND
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IC : center row of each node
</span><span class="comment">*</span><span class="comment"> NL : number of rows of left subproblem
</span><span class="comment">*</span><span class="comment"> NR : number of rows of right subproblem
</span><span class="comment">*</span><span class="comment"> NLF: starting row of the left subproblem
</span><span class="comment">*</span><span class="comment"> NRF: starting row of the right subproblem
</span><span class="comment">*</span><span class="comment">
</span> I1 = I - 1
IC = IWORK( INODE+I1 )
NL = IWORK( NDIML+I1 )
NLP1 = NL + 1
NR = IWORK( NDIMR+I1 )
NRP1 = NR + 1
NLF = IC - NL
NRF = IC + 1
SQREI = 1
CALL <a name="DLASDQ.161"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>( <span class="string">'U'</span>, SQREI, NL, NLP1, NL, NCC, D( NLF ), E( NLF ),
$ VT( NLF, NLF ), LDVT, U( NLF, NLF ), LDU,
$ U( NLF, NLF ), LDU, WORK, INFO )
IF( INFO.NE.0 ) THEN
RETURN
END IF
ITEMP = IDXQ + NLF - 2
DO 10 J = 1, NL
IWORK( ITEMP+J ) = J
10 CONTINUE
IF( I.EQ.ND ) THEN
SQREI = SQRE
ELSE
SQREI = 1
END IF
NRP1 = NR + SQREI
CALL <a name="DLASDQ.177"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>( <span class="string">'U'</span>, SQREI, NR, NRP1, NR, NCC, D( NRF ), E( NRF ),
$ VT( NRF, NRF ), LDVT, U( NRF, NRF ), LDU,
$ U( NRF, NRF ), LDU, WORK, INFO )
IF( INFO.NE.0 ) THEN
RETURN
END IF
ITEMP = IDXQ + IC
DO 20 J = 1, NR
IWORK( ITEMP+J-1 ) = J
20 CONTINUE
30 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Now conquer each subproblem bottom-up.
</span><span class="comment">*</span><span class="comment">
</span> DO 50 LVL = NLVL, 1, -1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the first node LF and last node LL on the
</span><span class="comment">*</span><span class="comment"> current level LVL.
</span><span class="comment">*</span><span class="comment">
</span> IF( LVL.EQ.1 ) THEN
LF = 1
LL = 1
ELSE
LF = 2**( LVL-1 )
LL = 2*LF - 1
END IF
DO 40 I = LF, LL
IM1 = I - 1
IC = IWORK( INODE+IM1 )
NL = IWORK( NDIML+IM1 )
NR = IWORK( NDIMR+IM1 )
NLF = IC - NL
IF( ( SQRE.EQ.0 ) .AND. ( I.EQ.LL ) ) THEN
SQREI = SQRE
ELSE
SQREI = 1
END IF
IDXQC = IDXQ + NLF - 1
ALPHA = D( IC )
BETA = E( IC )
CALL <a name="DLASD1.217"></a><a href="dlasd1.f.html#DLASD1.1">DLASD1</a>( NL, NR, SQREI, D( NLF ), ALPHA, BETA,
$ U( NLF, NLF ), LDU, VT( NLF, NLF ), LDVT,
$ IWORK( IDXQC ), IWORK( IWK ), WORK, INFO )
IF( INFO.NE.0 ) THEN
RETURN
END IF
40 CONTINUE
50 CONTINUE
<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="DLASD0.228"></a><a href="dlasd0.f.html#DLASD0.1">DLASD0</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?