dtzrzf.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 269 行 · 第 1/2 页
HTML
269 行
</span> INTEGER <a name="ILAENV.117"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
EXTERNAL <a name="ILAENV.118"></a><a href="hfy-index.html#ILAENV">ILAENV</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 arguments
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
LQUERY = ( LWORK.EQ.-1 )
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.M ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
IF( M.EQ.0 .OR. M.EQ.N ) THEN
LWKOPT = 1
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine the block size.
</span><span class="comment">*</span><span class="comment">
</span> NB = <a name="ILAENV.141"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DGERQF.141"></a><a href="dgerqf.f.html#DGERQF.1">DGERQF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
LWKOPT = M*NB
END IF
WORK( 1 ) = LWKOPT
<span class="comment">*</span><span class="comment">
</span> IF( LWORK.LT.MAX( 1, M ) .AND. .NOT.LQUERY ) THEN
INFO = -7
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.152"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DTZRZF.152"></a><a href="dtzrzf.f.html#DTZRZF.1">DTZRZF</a>'</span>, -INFO )
RETURN
ELSE IF( LQUERY ) THEN
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span> IF( M.EQ.0 ) THEN
RETURN
ELSE IF( M.EQ.N ) THEN
DO 10 I = 1, N
TAU( I ) = ZERO
10 CONTINUE
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> NBMIN = 2
NX = 1
IWS = M
IF( NB.GT.1 .AND. NB.LT.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine when to cross over from blocked to unblocked code.
</span><span class="comment">*</span><span class="comment">
</span> NX = MAX( 0, <a name="ILAENV.176"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 3, <span class="string">'<a name="DGERQF.176"></a><a href="dgerqf.f.html#DGERQF.1">DGERQF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 ) )
IF( NX.LT.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine if workspace is large enough for blocked code.
</span><span class="comment">*</span><span class="comment">
</span> LDWORK = M
IWS = LDWORK*NB
IF( LWORK.LT.IWS ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Not enough workspace to use optimal NB: reduce NB and
</span><span class="comment">*</span><span class="comment"> determine the minimum value of NB.
</span><span class="comment">*</span><span class="comment">
</span> NB = LWORK / LDWORK
NBMIN = MAX( 2, <a name="ILAENV.189"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 2, <span class="string">'<a name="DGERQF.189"></a><a href="dgerqf.f.html#DGERQF.1">DGERQF</a>'</span>, <span class="string">' '</span>, M, N, -1,
$ -1 ) )
END IF
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( NB.GE.NBMIN .AND. NB.LT.M .AND. NX.LT.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use blocked code initially.
</span><span class="comment">*</span><span class="comment"> The last kk rows are handled by the block method.
</span><span class="comment">*</span><span class="comment">
</span> M1 = MIN( M+1, N )
KI = ( ( M-NX-1 ) / NB )*NB
KK = MIN( M, KI+NB )
<span class="comment">*</span><span class="comment">
</span> DO 20 I = M - KK + KI + 1, M - KK + 1, -NB
IB = MIN( M-I+1, NB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the TZ factorization of the current block
</span><span class="comment">*</span><span class="comment"> A(i:i+ib-1,i:n)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DLATRZ.210"></a><a href="dlatrz.f.html#DLATRZ.1">DLATRZ</a>( IB, N-I+1, N-M, A( I, I ), LDA, TAU( I ),
$ WORK )
IF( I.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form the triangular factor of the block reflector
</span><span class="comment">*</span><span class="comment"> H = H(i+ib-1) . . . H(i+1) H(i)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DLARZT.217"></a><a href="dlarzt.f.html#DLARZT.1">DLARZT</a>( <span class="string">'Backward'</span>, <span class="string">'Rowwise'</span>, N-M, IB, A( I, M1 ),
$ LDA, TAU( I ), WORK, LDWORK )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Apply H to A(1:i-1,i:n) from the right
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DLARZB.222"></a><a href="dlarzb.f.html#DLARZB.1">DLARZB</a>( <span class="string">'Right'</span>, <span class="string">'No transpose'</span>, <span class="string">'Backward'</span>,
$ <span class="string">'Rowwise'</span>, I-1, N-I+1, IB, N-M, A( I, M1 ),
$ LDA, WORK, LDWORK, A( 1, I ), LDA,
$ WORK( IB+1 ), LDWORK )
END IF
20 CONTINUE
MU = I + NB - 1
ELSE
MU = M
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use unblocked code to factor the last or only block
</span><span class="comment">*</span><span class="comment">
</span> IF( MU.GT.0 )
$ CALL <a name="DLATRZ.236"></a><a href="dlatrz.f.html#DLATRZ.1">DLATRZ</a>( MU, N, N-M, A, LDA, TAU, WORK )
<span class="comment">*</span><span class="comment">
</span> 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="DTZRZF.242"></a><a href="dtzrzf.f.html#DTZRZF.1">DTZRZF</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?