dorgtr.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 208 行 · 第 1/2 页
HTML
208 行
</span> INTRINSIC MAX
<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 )
UPPER = <a name="LSAME.94"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.95"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -4
ELSE IF( LWORK.LT.MAX( 1, N-1 ) .AND. .NOT.LQUERY ) THEN
INFO = -7
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
IF( UPPER ) THEN
NB = <a name="ILAENV.107"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DORGQL.107"></a><a href="dorgql.f.html#DORGQL.1">DORGQL</a>'</span>, <span class="string">' '</span>, N-1, N-1, N-1, -1 )
ELSE
NB = <a name="ILAENV.109"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DORGQR.109"></a><a href="dorgqr.f.html#DORGQR.1">DORGQR</a>'</span>, <span class="string">' '</span>, N-1, N-1, N-1, -1 )
END IF
LWKOPT = MAX( 1, N-1 )*NB
WORK( 1 ) = LWKOPT
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.116"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DORGTR.116"></a><a href="dorgtr.f.html#DORGTR.1">DORGTR</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( N.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Q was determined by a call to <a name="DSYTRD.131"></a><a href="dsytrd.f.html#DSYTRD.1">DSYTRD</a> with UPLO = 'U'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Shift the vectors which define the elementary reflectors one
</span><span class="comment">*</span><span class="comment"> column to the left, and set the last row and column of Q to
</span><span class="comment">*</span><span class="comment"> those of the unit matrix
</span><span class="comment">*</span><span class="comment">
</span> DO 20 J = 1, N - 1
DO 10 I = 1, J - 1
A( I, J ) = A( I, J+1 )
10 CONTINUE
A( N, J ) = ZERO
20 CONTINUE
DO 30 I = 1, N - 1
A( I, N ) = ZERO
30 CONTINUE
A( N, N ) = ONE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Generate Q(1:n-1,1:n-1)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DORGQL.150"></a><a href="dorgql.f.html#DORGQL.1">DORGQL</a>( N-1, N-1, N-1, A, LDA, TAU, WORK, LWORK, IINFO )
<span class="comment">*</span><span class="comment">
</span> ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Q was determined by a call to <a name="DSYTRD.154"></a><a href="dsytrd.f.html#DSYTRD.1">DSYTRD</a> with UPLO = 'L'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Shift the vectors which define the elementary reflectors one
</span><span class="comment">*</span><span class="comment"> column to the right, and set the first row and column of Q to
</span><span class="comment">*</span><span class="comment"> those of the unit matrix
</span><span class="comment">*</span><span class="comment">
</span> DO 50 J = N, 2, -1
A( 1, J ) = ZERO
DO 40 I = J + 1, N
A( I, J ) = A( I, J-1 )
40 CONTINUE
50 CONTINUE
A( 1, 1 ) = ONE
DO 60 I = 2, N
A( I, 1 ) = ZERO
60 CONTINUE
IF( N.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Generate Q(2:n,2:n)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DORGQR.174"></a><a href="dorgqr.f.html#DORGQR.1">DORGQR</a>( N-1, N-1, N-1, A( 2, 2 ), LDA, TAU, WORK,
$ LWORK, IINFO )
END IF
END IF
WORK( 1 ) = LWKOPT
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="DORGTR.181"></a><a href="dorgtr.f.html#DORGTR.1">DORGTR</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?