cgelsy.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 410 行 · 第 1/3 页
HTML
410 行
</span> CALL <a name="CLASCL.256"></a><a href="clascl.f.html#CLASCL.1">CLASCL</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="CGEQP3.263"></a><a href="cgeqp3.f.html#CGEQP3.1">CGEQP3</a>( M, N, A, LDA, JPVT, WORK( 1 ), WORK( MN+1 ),
$ LWORK-MN, RWORK, INFO )
WSIZE = MN + REAL( WORK( MN+1 ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> complex workspace: MN+NB*(N+1). real workspace 2*N.
</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 ) = CONE
WORK( ISMAX ) = CONE
SMAX = ABS( A( 1, 1 ) )
SMIN = SMAX
IF( ABS( A( 1, 1 ) ).EQ.ZERO ) THEN
RANK = 0
CALL <a name="CLASET.278"></a><a href="claset.f.html#CLASET.1">CLASET</a>( <span class="string">'F'</span>, MAX( M, N ), NRHS, CZERO, CZERO, 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="CLAIC1.287"></a><a href="claic1.f.html#CLAIC1.1">CLAIC1</a>( IMIN, RANK, WORK( ISMIN ), SMIN, A( 1, I ),
$ A( I, I ), SMINPR, S1, C1 )
CALL <a name="CLAIC1.289"></a><a href="claic1.f.html#CLAIC1.1">CLAIC1</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"> complex 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="CTZRZF.315"></a><a href="ctzrzf.f.html#CTZRZF.1">CTZRZF</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"> complex 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="CUNMQR.323"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>( <span class="string">'Left'</span>, <span class="string">'Conjugate transpose'</span>, M, NRHS, MN, A, LDA,
$ WORK( 1 ), B, LDB, WORK( 2*MN+1 ), LWORK-2*MN, INFO )
WSIZE = MAX( WSIZE, 2*MN+REAL( WORK( 2*MN+1 ) ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> complex 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 CTRSM( <span class="string">'Left'</span>, <span class="string">'Upper'</span>, <span class="string">'No transpose'</span>, <span class="string">'Non-unit'</span>, RANK,
$ NRHS, CONE, 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 ) = CZERO
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="CUNMRZ.343"></a><a href="cunmrz.f.html#CUNMRZ.1">CUNMRZ</a>( <span class="string">'Left'</span>, <span class="string">'Conjugate 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"> complex 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 CCOPY( 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"> complex 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="CLASCL.364"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, SMLNUM, N, NRHS, B, LDB, INFO )
CALL <a name="CLASCL.365"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'U'</span>, 0, 0, SMLNUM, ANRM, RANK, RANK, A, LDA,
$ INFO )
ELSE IF( IASCL.EQ.2 ) THEN
CALL <a name="CLASCL.368"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, BIGNUM, N, NRHS, B, LDB, INFO )
CALL <a name="CLASCL.369"></a><a href="clascl.f.html#CLASCL.1">CLASCL</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="CLASCL.373"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, SMLNUM, BNRM, N, NRHS, B, LDB, INFO )
ELSE IF( IBSCL.EQ.2 ) THEN
CALL <a name="CLASCL.375"></a><a href="clascl.f.html#CLASCL.1">CLASCL</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 ) = CMPLX( 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="CGELSY.383"></a><a href="cgelsy.f.html#CGELSY.1">CGELSY</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?