dgelsy.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 416 行 · 第 1/3 页
HTML
416 行
</span><span class="comment">*</span><span class="comment"> Scale matrix norm down to BIGNUM
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DLASCL.262"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>( <span class="string">'G'</span>, 0, 0, BNRM, BIGNUM, M, NRHS, B, LDB, INFO )
IBSCL = 2
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute QR factorization with column pivoting of A:
</span><span class="comment">*</span><span class="comment"> A * P = Q * R
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DGEQP3.269"></a><a href="dgeqp3.f.html#DGEQP3.1">DGEQP3</a>( M, N, A, LDA, JPVT, WORK( 1 ), WORK( MN+1 ),
$ LWORK-MN, INFO )
WSIZE = MN + WORK( MN+1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> workspace: MN+2*N+NB*(N+1).
</span><span class="comment">*</span><span class="comment"> Details of Householder rotations stored in WORK(1:MN).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine RANK using incremental condition estimation
</span><span class="comment">*</span><span class="comment">
</span> WORK( ISMIN ) = ONE
WORK( ISMAX ) = ONE
SMAX = ABS( A( 1, 1 ) )
SMIN = SMAX
IF( ABS( A( 1, 1 ) ).EQ.ZERO ) THEN
RANK = 0
CALL <a name="DLASET.284"></a><a href="dlaset.f.html#DLASET.1">DLASET</a>( <span class="string">'F'</span>, MAX( M, N ), NRHS, ZERO, ZERO, B, LDB )
GO TO 70
ELSE
RANK = 1
END IF
<span class="comment">*</span><span class="comment">
</span> 10 CONTINUE
IF( RANK.LT.MN ) THEN
I = RANK + 1
CALL <a name="DLAIC1.293"></a><a href="dlaic1.f.html#DLAIC1.1">DLAIC1</a>( IMIN, RANK, WORK( ISMIN ), SMIN, A( 1, I ),
$ A( I, I ), SMINPR, S1, C1 )
CALL <a name="DLAIC1.295"></a><a href="dlaic1.f.html#DLAIC1.1">DLAIC1</a>( IMAX, RANK, WORK( ISMAX ), SMAX, A( 1, I ),
$ A( I, I ), SMAXPR, S2, C2 )
<span class="comment">*</span><span class="comment">
</span> IF( SMAXPR*RCOND.LE.SMINPR ) THEN
DO 20 I = 1, RANK
WORK( ISMIN+I-1 ) = S1*WORK( ISMIN+I-1 )
WORK( ISMAX+I-1 ) = S2*WORK( ISMAX+I-1 )
20 CONTINUE
WORK( ISMIN+RANK ) = C1
WORK( ISMAX+RANK ) = C2
SMIN = SMINPR
SMAX = SMAXPR
RANK = RANK + 1
GO TO 10
END IF
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> workspace: 3*MN.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Logically partition R = [ R11 R12 ]
</span><span class="comment">*</span><span class="comment"> [ 0 R22 ]
</span><span class="comment">*</span><span class="comment"> where R11 = R(1:RANK,1:RANK)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> [R11,R12] = [ T11, 0 ] * Y
</span><span class="comment">*</span><span class="comment">
</span> IF( RANK.LT.N )
$ CALL <a name="DTZRZF.321"></a><a href="dtzrzf.f.html#DTZRZF.1">DTZRZF</a>( RANK, N, A, LDA, WORK( MN+1 ), WORK( 2*MN+1 ),
$ LWORK-2*MN, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> workspace: 2*MN.
</span><span class="comment">*</span><span class="comment"> Details of Householder rotations stored in WORK(MN+1:2*MN)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B(1:M,1:NRHS) := Q' * B(1:M,1:NRHS)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DORMQR.329"></a><a href="dormqr.f.html#DORMQR.1">DORMQR</a>( <span class="string">'Left'</span>, <span class="string">'Transpose'</span>, M, NRHS, MN, A, LDA, WORK( 1 ),
$ B, LDB, WORK( 2*MN+1 ), LWORK-2*MN, INFO )
WSIZE = MAX( WSIZE, 2*MN+WORK( 2*MN+1 ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> workspace: 2*MN+NB*NRHS.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B(1:RANK,1:NRHS) := inv(T11) * B(1:RANK,1:NRHS)
</span><span class="comment">*</span><span class="comment">
</span> CALL DTRSM( <span class="string">'Left'</span>, <span class="string">'Upper'</span>, <span class="string">'No transpose'</span>, <span class="string">'Non-unit'</span>, RANK,
$ NRHS, ONE, A, LDA, B, LDB )
<span class="comment">*</span><span class="comment">
</span> DO 40 J = 1, NRHS
DO 30 I = RANK + 1, N
B( I, J ) = ZERO
30 CONTINUE
40 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B(1:N,1:NRHS) := Y' * B(1:N,1:NRHS)
</span><span class="comment">*</span><span class="comment">
</span> IF( RANK.LT.N ) THEN
CALL <a name="DORMRZ.349"></a><a href="dormrz.f.html#DORMRZ.1">DORMRZ</a>( <span class="string">'Left'</span>, <span class="string">'Transpose'</span>, N, NRHS, RANK, N-RANK, A,
$ LDA, WORK( MN+1 ), B, LDB, WORK( 2*MN+1 ),
$ LWORK-2*MN, INFO )
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> workspace: 2*MN+NRHS.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B(1:N,1:NRHS) := P * B(1:N,1:NRHS)
</span><span class="comment">*</span><span class="comment">
</span> DO 60 J = 1, NRHS
DO 50 I = 1, N
WORK( JPVT( I ) ) = B( I, J )
50 CONTINUE
CALL DCOPY( N, WORK( 1 ), 1, B( 1, J ), 1 )
60 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> workspace: N.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Undo scaling
</span><span class="comment">*</span><span class="comment">
</span> IF( IASCL.EQ.1 ) THEN
CALL <a name="DLASCL.370"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, SMLNUM, N, NRHS, B, LDB, INFO )
CALL <a name="DLASCL.371"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>( <span class="string">'U'</span>, 0, 0, SMLNUM, ANRM, RANK, RANK, A, LDA,
$ INFO )
ELSE IF( IASCL.EQ.2 ) THEN
CALL <a name="DLASCL.374"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, BIGNUM, N, NRHS, B, LDB, INFO )
CALL <a name="DLASCL.375"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>( <span class="string">'U'</span>, 0, 0, BIGNUM, ANRM, RANK, RANK, A, LDA,
$ INFO )
END IF
IF( IBSCL.EQ.1 ) THEN
CALL <a name="DLASCL.379"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>( <span class="string">'G'</span>, 0, 0, SMLNUM, BNRM, N, NRHS, B, LDB, INFO )
ELSE IF( IBSCL.EQ.2 ) THEN
CALL <a name="DLASCL.381"></a><a href="dlascl.f.html#DLASCL.1">DLASCL</a>( <span class="string">'G'</span>, 0, 0, BIGNUM, BNRM, N, NRHS, B, LDB, INFO )
END IF
<span class="comment">*</span><span class="comment">
</span> 70 CONTINUE
WORK( 1 ) = LWKOPT
<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="DGELSY.389"></a><a href="dgelsy.f.html#DGELSY.1">DGELSY</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?