dlasda.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 415 行 · 第 1/3 页
HTML
415 行
</span><span class="comment">*</span><span class="comment"> of Givens rotations performed on the I-th level on the
</span><span class="comment">*</span><span class="comment"> computation tree.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDGCOL (input) INTEGER, LDGCOL = > N.
</span><span class="comment">*</span><span class="comment"> The leading dimension of arrays GIVCOL and PERM.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> PERM (output) INTEGER array,
</span><span class="comment">*</span><span class="comment"> dimension ( LDGCOL, NLVL ) if ICOMPQ = 1, and not referenced
</span><span class="comment">*</span><span class="comment"> if ICOMPQ = 0. If ICOMPQ = 1, on exit, PERM(1, I) records
</span><span class="comment">*</span><span class="comment"> permutations done on the I-th level of the computation tree.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> GIVNUM (output) DOUBLE PRECISION array,
</span><span class="comment">*</span><span class="comment"> dimension ( LDU, 2 * NLVL ) if ICOMPQ = 1, and not
</span><span class="comment">*</span><span class="comment"> referenced if ICOMPQ = 0. If ICOMPQ = 1, on exit, for each I,
</span><span class="comment">*</span><span class="comment"> GIVNUM(1, 2 *I - 1) and GIVNUM(1, 2 *I) record the C- and S-
</span><span class="comment">*</span><span class="comment"> values of Givens rotations performed on the I-th level on
</span><span class="comment">*</span><span class="comment"> the computation tree.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C (output) DOUBLE PRECISION array,
</span><span class="comment">*</span><span class="comment"> dimension ( N ) if ICOMPQ = 1, and dimension 1 if ICOMPQ = 0.
</span><span class="comment">*</span><span class="comment"> If ICOMPQ = 1 and the I-th subproblem is not square, on exit,
</span><span class="comment">*</span><span class="comment"> C( I ) contains the C-value of a Givens rotation related to
</span><span class="comment">*</span><span class="comment"> the right null space of the I-th subproblem.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> S (output) DOUBLE PRECISION array, dimension ( N ) if
</span><span class="comment">*</span><span class="comment"> ICOMPQ = 1, and dimension 1 if ICOMPQ = 0. If ICOMPQ = 1
</span><span class="comment">*</span><span class="comment"> and the I-th subproblem is not square, on exit, S( I )
</span><span class="comment">*</span><span class="comment"> contains the S-value of a Givens rotation related to
</span><span class="comment">*</span><span class="comment"> the right null space of the I-th subproblem.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) DOUBLE PRECISION array, dimension
</span><span class="comment">*</span><span class="comment"> (6 * N + (SMLSIZ + 1)*(SMLSIZ + 1)).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IWORK (workspace) INTEGER array.
</span><span class="comment">*</span><span class="comment"> Dimension must be at least (7 * N).
</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> DOUBLE PRECISION ZERO, ONE
PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER I, I1, IC, IDXQ, IDXQI, IM1, INODE, ITEMP, IWK,
$ J, LF, LL, LVL, LVL2, M, NCC, ND, NDB1, NDIML,
$ NDIMR, NL, NLF, NLP1, NLVL, NR, NRF, NRP1, NRU,
$ NWORK1, NWORK2, SMLSZP, SQREI, VF, VFI, VL, VLI
DOUBLE PRECISION ALPHA, BETA
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL DCOPY, <a name="DLASD6.183"></a><a href="dlasd6.f.html#DLASD6.1">DLASD6</a>, <a name="DLASDQ.183"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>, <a name="DLASDT.183"></a><a href="dlasdt.f.html#DLASDT.1">DLASDT</a>, <a name="DLASET.183"></a><a href="dlaset.f.html#DLASET.1">DLASET</a>, <a name="XERBLA.183"></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"> .. 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( ( ICOMPQ.LT.0 ) .OR. ( ICOMPQ.GT.1 ) ) THEN
INFO = -1
ELSE IF( SMLSIZ.LT.3 ) THEN
INFO = -2
ELSE IF( N.LT.0 ) THEN
INFO = -3
ELSE IF( ( SQRE.LT.0 ) .OR. ( SQRE.GT.1 ) ) THEN
INFO = -4
ELSE IF( LDU.LT.( N+SQRE ) ) THEN
INFO = -8
ELSE IF( LDGCOL.LT.N ) THEN
INFO = -17
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.205"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DLASDA.205"></a><a href="dlasda.f.html#DLASDA.1">DLASDA</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> M = N + SQRE
<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.211"></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
IF( ICOMPQ.EQ.0 ) THEN
CALL <a name="DLASDQ.215"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>( <span class="string">'U'</span>, SQRE, N, 0, 0, 0, D, E, VT, LDU, U, LDU,
$ U, LDU, WORK, INFO )
ELSE
CALL <a name="DLASDQ.218"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>( <span class="string">'U'</span>, SQRE, N, M, N, 0, D, E, VT, LDU, U, LDU,
$ U, LDU, WORK, INFO )
END IF
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Book-keeping and 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
<span class="comment">*</span><span class="comment">
</span> NCC = 0
NRU = 0
<span class="comment">*</span><span class="comment">
</span> SMLSZP = SMLSIZ + 1
VF = 1
VL = VF + M
NWORK1 = VL + M
NWORK2 = NWORK1 + SMLSZP*SMLSZP
<span class="comment">*</span><span class="comment">
</span> CALL <a name="DLASDT.241"></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.245"></a><a href="dlasdq.f.html#DLASDQ.1">DLASDQ</a>.
</span><span class="comment">*</span><span class="comment">
</span> NDB1 = ( ND+1 ) / 2
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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?