dorgbr.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 269 行 · 第 1/2 页
HTML
269 行
</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
WANTQ = <a name="LSAME.121"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'Q'</span> )
MN = MIN( M, N )
LQUERY = ( LWORK.EQ.-1 )
IF( .NOT.WANTQ .AND. .NOT.<a name="LSAME.124"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'P'</span> ) ) THEN
INFO = -1
ELSE IF( M.LT.0 ) THEN
INFO = -2
ELSE IF( N.LT.0 .OR. ( WANTQ .AND. ( N.GT.M .OR. N.LT.MIN( M,
$ K ) ) ) .OR. ( .NOT.WANTQ .AND. ( M.GT.N .OR. M.LT.
$ MIN( N, K ) ) ) ) THEN
INFO = -3
ELSE IF( K.LT.0 ) THEN
INFO = -4
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -6
ELSE IF( LWORK.LT.MAX( 1, MN ) .AND. .NOT.LQUERY ) THEN
INFO = -9
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 ) THEN
IF( WANTQ ) THEN
NB = <a name="ILAENV.142"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DORGQR.142"></a><a href="dorgqr.f.html#DORGQR.1">DORGQR</a>'</span>, <span class="string">' '</span>, M, N, K, -1 )
ELSE
NB = <a name="ILAENV.144"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="DORGLQ.144"></a><a href="dorglq.f.html#DORGLQ.1">DORGLQ</a>'</span>, <span class="string">' '</span>, M, N, K, -1 )
END IF
LWKOPT = MAX( 1, MN )*NB
WORK( 1 ) = LWKOPT
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.151"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DORGBR.151"></a><a href="dorgbr.f.html#DORGBR.1">DORGBR</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 .OR. N.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> IF( WANTQ ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form Q, determined by a call to <a name="DGEBRD.166"></a><a href="dgebrd.f.html#DGEBRD.1">DGEBRD</a> to reduce an m-by-k
</span><span class="comment">*</span><span class="comment"> matrix
</span><span class="comment">*</span><span class="comment">
</span> IF( M.GE.K ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If m >= k, assume m >= n >= k
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DORGQR.173"></a><a href="dorgqr.f.html#DORGQR.1">DORGQR</a>( M, N, K, 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"> If m < k, assume m = n
</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
</span><span class="comment">*</span><span class="comment"> to those of the unit matrix
</span><span class="comment">*</span><span class="comment">
</span> DO 20 J = M, 2, -1
A( 1, J ) = ZERO
DO 10 I = J + 1, M
A( I, J ) = A( I, J-1 )
10 CONTINUE
20 CONTINUE
A( 1, 1 ) = ONE
DO 30 I = 2, M
A( I, 1 ) = ZERO
30 CONTINUE
IF( M.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form Q(2:m,2:m)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DORGQR.197"></a><a href="dorgqr.f.html#DORGQR.1">DORGQR</a>( M-1, M-1, M-1, A( 2, 2 ), LDA, TAU, WORK,
$ LWORK, IINFO )
END IF
END IF
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form P', determined by a call to <a name="DGEBRD.203"></a><a href="dgebrd.f.html#DGEBRD.1">DGEBRD</a> to reduce a k-by-n
</span><span class="comment">*</span><span class="comment"> matrix
</span><span class="comment">*</span><span class="comment">
</span> IF( K.LT.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If k < n, assume k <= m <= n
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DORGLQ.210"></a><a href="dorglq.f.html#DORGLQ.1">DORGLQ</a>( M, N, K, 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"> If k >= n, assume m = n
</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"> row downward, and set the first row and column of P' to
</span><span class="comment">*</span><span class="comment"> those of the unit matrix
</span><span class="comment">*</span><span class="comment">
</span> A( 1, 1 ) = ONE
DO 40 I = 2, N
A( I, 1 ) = ZERO
40 CONTINUE
DO 60 J = 2, N
DO 50 I = J - 1, 2, -1
A( I, J ) = A( I-1, J )
50 CONTINUE
A( 1, J ) = ZERO
60 CONTINUE
IF( N.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Form P'(2:n,2:n)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DORGLQ.234"></a><a href="dorglq.f.html#DORGLQ.1">DORGLQ</a>( N-1, N-1, N-1, A( 2, 2 ), LDA, TAU, WORK,
$ LWORK, IINFO )
END IF
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="DORGBR.242"></a><a href="dorgbr.f.html#DORGBR.1">DORGBR</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?