zgelsy.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 410 行 · 第 1/3 页
HTML
410 行
</span> CALL <a name="ZLASCL.256"></a><a href="zlascl.f.html#ZLASCL.1">ZLASCL</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="ZGEQP3.263"></a><a href="zgeqp3.f.html#ZGEQP3.1">ZGEQP3</a>( M, N, A, LDA, JPVT, WORK( 1 ), WORK( MN+1 ),
$ LWORK-MN, RWORK, INFO )
WSIZE = MN + DBLE( 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="ZLASET.278"></a><a href="zlaset.f.html#ZLASET.1">ZLASET</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="ZLAIC1.287"></a><a href="zlaic1.f.html#ZLAIC1.1">ZLAIC1</a>( IMIN, RANK, WORK( ISMIN ), SMIN, A( 1, I ),
$ A( I, I ), SMINPR, S1, C1 )
CALL <a name="ZLAIC1.289"></a><a href="zlaic1.f.html#ZLAIC1.1">ZLAIC1</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="ZTZRZF.315"></a><a href="ztzrzf.f.html#ZTZRZF.1">ZTZRZF</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="ZUNMQR.323"></a><a href="zunmqr.f.html#ZUNMQR.1">ZUNMQR</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+DBLE( 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 ZTRSM( <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="ZUNMRZ.343"></a><a href="zunmrz.f.html#ZUNMRZ.1">ZUNMRZ</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 ZCOPY( 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="ZLASCL.364"></a><a href="zlascl.f.html#ZLASCL.1">ZLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, SMLNUM, N, NRHS, B, LDB, INFO )
CALL <a name="ZLASCL.365"></a><a href="zlascl.f.html#ZLASCL.1">ZLASCL</a>( <span class="string">'U'</span>, 0, 0, SMLNUM, ANRM, RANK, RANK, A, LDA,
$ INFO )
ELSE IF( IASCL.EQ.2 ) THEN
CALL <a name="ZLASCL.368"></a><a href="zlascl.f.html#ZLASCL.1">ZLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, BIGNUM, N, NRHS, B, LDB, INFO )
CALL <a name="ZLASCL.369"></a><a href="zlascl.f.html#ZLASCL.1">ZLASCL</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="ZLASCL.373"></a><a href="zlascl.f.html#ZLASCL.1">ZLASCL</a>( <span class="string">'G'</span>, 0, 0, SMLNUM, BNRM, N, NRHS, B, LDB, INFO )
ELSE IF( IBSCL.EQ.2 ) THEN
CALL <a name="ZLASCL.375"></a><a href="zlascl.f.html#ZLASCL.1">ZLASCL</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 ) = DCMPLX( 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="ZGELSY.383"></a><a href="zgelsy.f.html#ZGELSY.1">ZGELSY</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?